Sean
Sean

Reputation: 1522

Why are custom error pages not working for 404 errors

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

Upvotes: 1

Views: 889

Answers (2)

Drew
Drew

Reputation: 152

    <httpErrors>
        <clear />
        <error statusCode="404" subStatusCode="-1" path="/404.asp" responseMode="ExecuteURL" />
    </httpErrors>

Upvotes: 0

Robert Harvey
Robert Harvey

Reputation: 180777

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.

Upvotes: 1

Related Questions