Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > customErrors

Reply
Thread Tools

customErrors

 
 
poifull
Guest
Posts: n/a
 
      05-14-2007
Hi all,

I specified an aspx page in my web.config/customErrors tag to handle any
error that might occur.
When an exception is thrown, Server.GetLastError() returns null in the error
handling page. Please let me know if my approach is wrong.

Web.config:
<customErrors defaultRedirect="ShowErrorMessage.aspx" mode="On" />


ShowErrorMessage.aspx:

protected void Page_Load(object sender, EventArgs e)
{

Response.Write(Server.GetLastError() == null); // prints True

}


Thanks in advance.



 
Reply With Quote
 
 
 
 
=?Utf-8?B?U2l2YSBN?=
Guest
Posts: n/a
 
      05-15-2007
Server.GetLastError() gets exception details only in Page_Error and
Application_Error (if the error was not cleared in Page_Error). If you need
the exception details in the custom error's default redirect page, store the
exception in an application variable and access it in the custom error page
(without calling Server.ClearError in Application_Error and Page_Error).


"poifull" wrote:

> Hi all,
>
> I specified an aspx page in my web.config/customErrors tag to handle any
> error that might occur.
> When an exception is thrown, Server.GetLastError() returns null in the error
> handling page. Please let me know if my approach is wrong.
>
> Web.config:
> <customErrors defaultRedirect="ShowErrorMessage.aspx" mode="On" />
>
>
> ShowErrorMessage.aspx:
>
> protected void Page_Load(object sender, EventArgs e)
> {
>
> Response.Write(Server.GetLastError() == null); // prints True
>
> }
>
>
> Thanks in advance.
>
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
.NET question about the customErrors Tag =?Utf-8?B?U2FtdWVs?= ASP .Net 6 05-11-2004 01:23 PM
customErrors issues Pete Davis ASP .Net 5 03-06-2004 03:17 PM
<customErrors .... not working?? =?Utf-8?B?cmV6YQ==?= ASP .Net 1 02-18-2004 11:52 PM
CustomErrors statusCode 500 Jesse Napier ASP .Net 3 08-07-2003 09:07 PM
customErrors 404 NRao ASP .Net 1 07-01-2003 04:33 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57