1

We have a couple of hundred web sites that each have their own web.config file and so far the only suggestion I've found for this issue is to update the web.config file (for example - IIS7 custom 404 not showing). That isn't going to happen with these many sites. I'm hoping there's an alternative.

I have the following method called when some information can't be loaded on a page. When I run it locally it does redirect me to 404Err.aspx but it doesn't when running on the live site (IIS7).

private void Set404()
{
    Response.Clear();
    Response.Status = "404 Not Found";
    Response.StatusCode = 404;
    Server.Transfer("~/404Err.aspx");
}

I started to wonder if by setting the statuscode to 404, it triggers the 404 error within IIS. So I tried editing the 404 Error Pages on the server by going to IIS>Error Pages>404>Edit Feature Set, select Custom error pages, provide the path /404Err.aspx and type is Execute URL. Still no luck.

I use this same method on windows 03, IIS6 boxes and it works fine. Is there anything else I can do besides editing the web.config file?

Community
  • 1
  • 1
geoff swartz
  • 5,437
  • 11
  • 51
  • 75

0 Answers0