Home All Groups Group Topic Archive Search About

Getting more detailed errors

Author
10 Jun 2005 8:24 PM
darrel
I have a question below about an error I am getting:

Exception has been thrown by the target of an invocation.

Is there anyway to get asp.net to give me more details than the above? My
catch statement is as such:

Catch exc As system.Exception
div_updateLog.Visible = true
lbl_updateLog.text = exc.Message
End Try

-Darrel

Author
11 Jun 2005 5:47 AM
Alan Ferrandiz Langley [MCT]
In the applications I develop I catch any exception in the Global_Error event handler in the Global.asax file. Basically I use

Request.FilePath to get the name of the file where the error was thrown
Server.GetLastError.InnerException this is actually the detailed exception you might be looking for .. i find this property extremely useful
Server.GetLastError.StackTrace you get the sequence of procedures executed that lead to the exception
Server.MachineName the server name where the exception ocurred, you can skip this but in my case i have both a development and production server and this property allows me to tell if I caused the exception when developing or the exception was thrown by a user
Request.ServerVariables("HTTP_USER_AGENT") the client browser information ... very useful if you want to create statistics about who mess with your app
Request.ServerVariables("REMOTE_ADDR") the client IP adress where the error ocurred... if you are in an intranet it is useful but if you app is public then you probably are behind a firewall and you will get the firewall IP adress.

I create a report email for every exception. Play around with them and try several ways to catch and handle exceptions

Hope this helps
Alan Ferrandiz Langley
geekswithblogs.com/aferrandiz




Show quoteHide quote
"darrel" <notr***@hotmail.com> escribió en el mensaje news:uOEbnpfbFHA.456@TK2MSFTNGP09.phx.gbl...
>I have a question below about an error I am getting:
>
> Exception has been thrown by the target of an invocation.
>
> Is there anyway to get asp.net to give me more details than the above? My
> catch statement is as such:
>
> Catch exc As system.Exception
> div_updateLog.Visible = true
> lbl_updateLog.text = exc.Message
> End Try
>
> -Darrel
>
>
Are all your drivers up to date? click for free checkup

Author
13 Jun 2005 3:31 PM
darrel
> In the applications I develop I catch any exception in the Global_Error
> event handler in the Global.asax file. Basically I use

Alan:

That's a very thorough list. Thank you!

-Darrel

Bookmark and Share