Forum Moderators: open

Message Too Old, No Replies

Problem with IIS 404 redirecting to ASPX page

IIS 404 redirection not parsing ASPX properly

         

sadukie

4:46 pm on Nov 15, 2007 (gmt 0)

10+ Year Member



I've got an ASP.NET site that has some issues with IIS 5.1 on Windows XP Pro SP2 and loading the ASPX page when it redirects the status code 404.

IIS is set to redirect 404 errors to Error404.aspx. IIS logs the 404 error in its log. However, when IIS brings up the Error404.aspx page, I get:

The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.

--------------------------------------------------------------------------------

A name was started with an invalid character. Error processing resource 'http://rootsite/subdir/test.htm'. Li...

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Error404.aspx.cs" Inherits="Error404" Title="Error - File Not Fou...

--------------------------------------------------------------------------------

What's weird is that I can access this page directly when I go to
http://rootsite/subdir/Error404.aspx and it also works on the ASP.NET redirection (customErrors in web.config). It seems to be just the IIS redirection that doesn't parse it properly.

I've tried unregistering and reregistering ASP.NET 2.0 for IIS, re-enabling it on the virtual directory. I've also reinstalled ASP.NET 2.0 but there's no difference.

Any ideas on what's going on here and how to fix it?

Thanks in advance!

[edited by: encyclo at 5:23 pm (utc) on Nov. 15, 2007]
[edit reason] delinked URL [/edit]

sadukie

5:19 pm on Nov 15, 2007 (gmt 0)

10+ Year Member



The above is my development environment. Apparently I'm going to run into a little more trouble when I move the site to its testing and production environment: IIS 5.0 on Windows 2000 Server.

When I copied the files to its test server, I get similar behavior as above. I can access the 404 page fine directly or through web.config redirection. But with IIS 5.0, when it redirects, it just spits out the source. No XML error or anything.

I'm afraid I'm overlooking something simple, but I'm not familiar enough with IIS to know what that may be.

Any insight is much appreciated!

sadukie

1:55 pm on Nov 16, 2007 (gmt 0)

10+ Year Member



I had posted this on another set of IIS forums and one of their posters was able to point me in the right direction.

Changing from a file to a URL got the page to parse properly.

Just wanted to post the response in case someone else runs into this problem and comes across this thread.