Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
rtutus
Aged Yak Warrior
522 Posts |
Posted - 2006-10-19 : 12:45:39
|
When we have a page that gives an error,can we display tracing information (like the value of a variable) without displaying all that other information that trace generates( session, cookies...). I only want to display the variable and its value on the page.I guess I can t do that with Response.write since the page generates an error during execution.Thank you. |
|
MichaelP
Jedi Yak
2489 Posts |
Posted - 2006-10-19 : 14:29:00
|
Use the trace.axd file to display the trace info.For example, if you have http://localhost/yoursite/default.aspxand there was an error on that page and you had some trace.warn statements in that page to check some variables, you can go to http://localhost/yoursite/trace.axd to get the last 10 HTTP requests for your site. Be sure to check your web.config and make sure tracing is enabled.<trace enabled="true" requestLimit="10" pageOutput="false" traceMode="SortByTime" localOnly="true" /> Michael<Yoda>Use the Search page you must. Find the answer you will. Cursors, path to the Dark Side they are. Avoid them, you must. Use Order By NewID() to get a random record you will.</Yoda>Opinions expressed in this post are not necessarily those of TeleVox Software, inc. All information is provided "AS IS" with no warranties and confers no rights. |
 |
|
snSQL
Master Smack Fu Yak Hacker
1837 Posts |
Posted - 2006-10-19 : 16:21:50
|
You'll need to add proper error handling to your page code (try/catch blocks). That will stop the page from dying and generating the normal error page, you can then get the error message and display it in the page however you want to - for example you could have a label on the page that is disabled, but if an error occurs set its text to the error message and enable the label.Be very careful doing that though because you don't usually want users of you site seeing error messages - partly because it doesn't look good and also because sometimes an error message can include information that would be a security problem if shown in a page.Note that another option you have is to add code to the Application_Error event handler in the global.asax - all unhandled errors raise that event, so you could put code in there to log the error for example. |
 |
|
rtutus
Aged Yak Warrior
522 Posts |
Posted - 2006-10-20 : 14:10:08
|
Thank you |
 |
|
|
|
|