|
-
Mar 10th, 2006, 07:06 AM
#1
Thread Starter
Fanatic Member
Server.GetLastError()
I am using Server.GetLastError() to get error details for logging, which is fine, but what I really need is the actual line of code that caused the error.
If you don't have a custom error page, it shows you the actual line that caused the error but I can't seem to find it in the Server.GetLastError() object.
I have noticed that the following code gets me the name of the procedure in which the error occurred:
VB Code:
appException = Server.GetLastError()
MsgBox(appException.TargetSite.Name)
But not the actual line of code that triggered the error.
Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment. 
-
Mar 10th, 2006, 07:26 AM
#2
Re: Server.GetLastError()
Look at the properties of the exception named SOURCE, MESSAGE, STACKTRACE.
-
Mar 10th, 2006, 07:30 AM
#3
Thread Starter
Fanatic Member
Re: Server.GetLastError()
I have. They don't give me what I need.
Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment. 
-
Mar 12th, 2006, 05:19 AM
#4
Re: Server.GetLastError()
Sorry, I haven't been able to find anything for this. It seems like the line-of-code that's erroring out is something that the framework keeps to itself, for security purposes?
-
Mar 13th, 2006, 03:41 AM
#5
Thread Starter
Fanatic Member
Re: Server.GetLastError()
Oh dear...
Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment. 
-
Mar 13th, 2006, 01:03 PM
#6
Re: Server.GetLastError()
One thing to make sure of:
Did you compile the Application to DEBUG and no RELEASE? Lines of code are not available in release compiles. Also, make sure that the PDB file got uploaded. This is the debug trace hook file.
All that said, it is entirely possible it will not keep the line number around because you have to execute this code (Server.GetLastError()) AFTER the page exception occurs and is thrown, which has probably cleared the exception stack already.
Need to re-register ASP.NET?
C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i
(Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|