Custom Errors (Getting Crazy!!!)

V

VR

Hí, I'm trying to implement an application wide error handling model to my
app and I cannot find a full documentation about it. Also, the pieces of
documentation found in msdn.microsoft.com do not seems to fit togheter...

Objective: not to use try..catch blocks and always redirect users to a
centralized error page to show the error message

Try1:
-> I changed web.config's customErrors element to "On" and set the
defaultRedirect to "error.aspx"

problem: as it is a client redirect I cannot access the Server.GetLastError
from the error page (one request causes the error and the second request
calls the error page)

Try2:
-> I changed the customErrors element to "Off", and in global.asax's
App_Error event, set a Server.Transfer("Error.aspx")

problem: I do not get to Error.aspx (the default ASP.Net error page is
shown - not my page)

Try3:
-> I changed the customErrors element to "On" (with the same global.asax
implementation)

problem: I do not get to Error.aspx (but some new ASP.Net general error page
is shown - Runtime Error - with just a few information)

Try4:
-> I put back the defaultRedirect attribute to the customError element (all
the rest is like Try3)

problem: it seems to be a client redirect taking place again
(Server.GetLastError = Nothing)


I don't know what can I try next. Could anyone give me a clue? What am I
missing?

I'm trying to follow the design shown in this article that says that if you
use server.transfer() you'll not loose the context and will be able to call
server.getlasterror():

http://msdn.microsoft.com/library/e...eHandlingApplicationLevelError.asp?frame=true

Thanks a lot,
Regards,
Victor
 
V

VR

I solved it, the only problem is that I had to store the exception in a
session variable and use response.redirect, I don't know why, but I could
not use Server.Transfer at all!!!

regards,
Victor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top