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
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.
<httpErrors>
<clear />
<error statusCode="404" subStatusCode="-1" path="/404.asp" responseMode="ExecuteURL" />
</httpErrors>
精彩评论