views:

615

answers:

1

Hi,

this is my first post on this great source of programming information.

I have developed new site for client and just doing some finishing touches.

I am trying to create custom error pages which would be read from web.config

 <system.web>
 <customErrors mode="RemoteOnly">
           <error statusCode="404" redirect="404.aspx" />
           <error statusCode="500" redirect="500.aspx" />
    </customErrors>

It works well on local development machine and 404 and 500 errors are shown as required.

After compilation and publishing site to web server it doesnt work. IIS 6 keeps on showing original IIS 6 error pages like this 404 error:

The page cannot be found

The page you are looking for might have been removed, 
had its name changed, or is temporarily unavailable. 
Please try the following:

Make sure that the Web site address displayed in the address bar of 
your browser is spelled and formatted correctly.

If you reached this page by clicking a link, contact the Web site 
administrator to alert them that the link is incorrectly formatted.

Click the Back button to try another link.
HTTP Error 404 - File or directory not found.
Internet Information Services (IIS)

I am not sure why is it doing this, I thought that web.config overwrites original IIS6 settings.

Thank you for your help.

Fero


Ok I have found out that the problem is with the 404 .aspx page only. Error 500 is working fine and showing 500.aspx page. But not for 404.aspx. Please advice

+2  A: 

The web config will only override IIS6 settings if the request is passed to the .NET ISAPI filter - for example, for pages ending with .aspx

If I browsed to a file or directory that didn't get to the .NET ISAPI it wouldn't use the web.config rules.

Sohnee
So what would be the solution for thos problem? Do I need to change something on IIS6?
feronovak