4

I'm trying to configure Custom Errors in IIS6.

I select the 404 error, set the dropdown to "URL," then enter this as the URL "/404.aspx"

When go to:

http://mysite.com/no-page-here

It finds 404.aspx, but doesn't process it as a .Net page -- it tries to serve up the source as an XML file, then fails because it won't parse.

404s work fine on .Net pages because I set that in the CustomErrors element of the web.config. But for non-.Net resources, I have to use IIS errors, and it refuses to just redirect to the 404 page. It's trying to serve it up the source code, essentially.

Deane
  • 247
  • 3
  • 9

8 Answers8

1

Do you have the correct extensions enabled in IIS6? In the IIS manager, go to Web Extensions (usually the last item in the left-hand navigation tree) and make sure that all the appropriate ones are enabled (usually .NET). Otherwise, this is exactly what will happen.

Mark Henderson
  • 68,823
  • 31
  • 180
  • 259
  • There's actually nothing in the Web Service Extensions folder, which is odd (it's not my server, actually -- it belongs to a client). However, I'm running an extensive ASP.Net-based site on the server, so I *know* it will execute .Net code. – Deane Jul 01 '09 at 21:22
  • Scratch that last comment about there being nothing in that folder -- I had restarted IIS and the MMC had lost its connection. Once I reconnected, there are extensions, and the correct ones are enabled. – Deane Jul 01 '09 at 21:23
0

Have you tried putting in the full URL instead of just the "/"? I thought this behavoir happened when you chose "file" and not URL, but perhaps if it is a local URL it bypasses the ASP.Net worker process as well.

Adam Brand
  • 6,127
  • 2
  • 30
  • 40
  • Yes, it's absolutely acting as if I have selected "File," but I promise you the dropdown is "URL." Also odd -- I have the .Net framework wild-carded anyway. So all requests should be hitting th framework and being handled by the CustomErrors defined in the web.config. I have no explanation for that either. – Deane Jul 01 '09 at 21:37
0

Sounds like you've got a bug in the error file itself. If you browse to the file does it get served properly or do you get the same symptoms?

squillman
  • 37,883
  • 12
  • 92
  • 146
0

I dont think you can have a dynamic page served up as your 404. If i remember correctly, it needs to be a static page. I guess you could redirect with meta or JS to a dynamic page from there, although that isnt "standard"

ChickenMilkBomb
  • 419
  • 6
  • 14
0

This Technet Article says to make sure and choose URL, or risk returning the source code of the page.

This Article explains how you can use the global.asax file to trap all application errors, including 404.

Global.asax needs to have:

protected void Application_Error(object sender, EventArgs e)
{
}

When any exception is thrown now—be it a general exception or a 404—it will end up in Application_Error.

Jack B Nimble
  • 1,505
  • 1
  • 10
  • 13
0

What you want is, set the dropdown to URL and then enter '/sitename/404.aspx' where sitename is the root directory of the website.

0

It really acts like you set "File" instead of "URL" - but you didn't. What happens when you insert the whole 404 URL in a browser? If that works, as workaround you could try to insert the complete URL instead of /404.aspx:

http://www.example.com/404.aspx

You mention that this is a customer's server. Make sure, that there are not two web sites pointing to the same physical directory and you're editing the wrong one. Are there more And make also sure that the website is marked as application.

splattne
  • 28,508
  • 20
  • 98
  • 148
0

From the sounds of it your trying to use the web.config to point to a .NET error page. This will only work for .Net pages. If you use a mix of say Classic ASP and .Net you must set IIS errors to point to the file you want. For this you have to have access to the server directly. Or write something in your Global.asa to redirect on errors.

At least thats how I've alsways had to do it.

Edit: Now that I'm thinking about it a little more and did a little digging on my localhost it does not look like you can point the Custom Errors to a .Net page. It does nto appear to use ASP.NET to process those pages which of course is required to render it. You will need to use an HTML page and maybe redirect from there.

Tim Meers
  • 663
  • 6
  • 16