views:

149

answers:

2

I have set up a page to handle errors that occur in a website I work on using web.config. I have used the customErrors section in web.config to do this, as described here

Here is the relevant section

  <customErrors mode="On" defaultRedirect="page.aspx?IDDataTreeMenu=357">
     <error statusCode="403" redirect="page.aspx?IDDataTreeMenu=357"/>
     <error statusCode="404" redirect="page.aspx?IDDataTreeMenu=357" />
  </customErrors>

This seems to work for all errors except 404. I just get the standard IIS 404 error when accessing a URL that doesn't exist.

What am I missing here?

This site is hosted on a shared server, so changing settings in IIS is not an option

+1  A: 

Check with the ISP and see if they have a place where you can insert a reference to your own custom 404 page.

At Network Solutions they give you a control panel and a page where you can set this up.

Robert Harvey
Surprisingly they don't have a control panel where I can change this sort of thing.
Sean
A: 
    <httpErrors>
        <clear />
        <error statusCode="404" subStatusCode="-1" path="/404.asp" responseMode="ExecuteURL" />
    </httpErrors>
Drew