Well, I'm not sure why your Label isn't working, but I do have a comment
about the approach in general. Once this goes to production, I'd suggest
not doing this. The reason is that you shouldn't show exception information
to an end user. If the end user is an attacker (malicious) then they can
use that information against you. Instead, you should only ever show vague
information that "there was some sort of problem". Of course, log that in
your global.asax's Application_Error method so an admin has all the info,
but don't give it to your users.
-Brock
DevelopMentor
http://staff.develop.com/ballen Hi!
I want to set up an exception handler in my asp.net page which handles
all
unhandled exception. When the exception is trapped I want to assign
its
message to a label. How can I do this?
I have tryied to do like this:
Protected Sub Page_Error(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Error
Label.text = Server.GetLastError().Message()
Server.ClearError()
End Sub
The exception is trapped but I got a blank page. Why is that? Is it
possible to do what i´m trying to do?