Customize Error Page

S

Shabam

When I set validateRequest="true", and a user tries to submit html into the
form, the server returns with a huge error page detailing what wasn't
allowed.

Is there a way to customize just this error page to something more friendly?
I want to use different error pages for other things, but for this one I'd
like to customize it. Is this possible?
 
N

Nicole Calinoiu

One approach would be to catch the error from the Application_Error
procedure in your Global.asax file. e.g.:

protected void Application_Error(Object sender, EventArgs e)
{
Exception ex = Server.GetLastError();
if (ex is HttpRequestValidationException)
{
// Do one thing.
}
else
{
// Do something else.
}
}

HTH,
Nicole
 

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

Top