Using customErrors (.net 2) in Web.config

S

stuart.bromhead

Can you help!!

I have put in my web.config:
<customErrors mode="On" defaultRedirect="~/ErrorPage.aspx">
<error statusCode="403" redirect="~/ErrorPage.aspx"/>
<error statusCode="404" redirect="~/ErrorPage.aspx"/>
</customErrors>

This works when you put in a invalid page ie www.mysite.com/test.aspx.
The problem I have is that if you put anything else in the URL like:
www.mysite.com/test.asp or www.mysite.com/test the error page is NOT
shown.

What have I done wrong?????
 
J

Juan T. Llibre

You have done nothing wrong.
Your web.config entries only apply to files mapped to aspnet_isapi.dll.

You can do two things to get more functionality.

1. Map the extensions you want caught to aspnet_isapi.dll.
That might cause some performance loss.

2. Edit the standard IIS http error pages so they return the info you want returned.
They are located in Drive:\%WINDIR%\Help\iisHelp\common

Make sure you back them up first...just in case somethng goes wrong.
 

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,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top