Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I force a redirect to the standard ASP .NET server error page?

Status
Not open for further replies.

afroblanca

Programmer
Jul 15, 2005
67
US
Hey all,

Here's the situation -

Say that you've caught an exception, and you want to manually redirect to the standard ASP .NET server error page, and you want the page to display all the appropriate information about the exception that you caught. Is this possible?

Here's the background information -

I'm working with AJAX .NET, which has a really lame way of handling exceptions. I'm able to get around some of the lameness by handling the AsyncPostBackError event. What this does is allow my code to catch the exception, which is great. However, here's the catch - I can't just throw the exception from my AsyncPostBackError handler. If I do, then AJAX .NET's lame exception handler kicks in, and ruins the whole show. What I want to do is take the exception that I've caught, and somehow 'throw' it to the standard ASP .NET server error page. This seems like something that I should be able to do.

Any thoughts on the matter?
 
You'll be better off creating your own error page and redirect to this. At least you can the keep the style of your application and decide in that page whether to show the full error information or not (standard users will not want to see this message!).


-------------------------------------------------------

Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]
[URL unfurl="true"]http://mdssolutions.co.uk[/url] - Delivering professional ASP.NET solutions
[URL unfurl="true"]http://weblogs.asp.net/marksmith[/url]
 
Right. Well, the deal is that I actually have a bunch of exception handling routines in my code already. And they're all predicated upon an exception being handled in the usual way, and not being intercepted by AJAX .NET.

In my code, if debug mode is turned off, then the user is redirected to a user-friendly error page. But before that happens, the Application_Error event in my Global.asax is fired, which does all sorts of logging. When I have debug mode turned on, after Application_Error fires, I get the standard .NET error page.

AJAX.NET screws all of this up. When an exception is thrown, Application_Error never fires, and instead of being redirected to the server error page, we get a dinky little javascript dialog.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top