Question about custom errors.

R

Ranv

Is it possible to use web.config to handle 404 Page Not Found errors,
and application level custom errors (in global.asax) to handle all
other errors? I suppose I would have to make sure that I don't call
Context.ClearError(); when a 404 Error occurs, but how do I check in
code that this has occured?

What I have right now in global.asax is:

protected void Application_Error(object sender, EventArgs e)
{
Response.Write( Server.GetLastError().ToString() );
Context.ClearError();
}

I've set up web.config to handle 404 errors, but when they occur, the
function in global.asax handles them instead. Hopefuly someone can
help. Thanks in advance.
 

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

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,267
Latest member
WaylonCogb

Latest Threads

Top