antic
Perch
Hi all,
In my .net application, I want to handle 404 errors in the "normal" way that IIS handles them for all files.
So I set up a custom 404 file in ISS as normal. For example, my custom error file is "/custom404.aspx":
This works fine for missing files of all types - html, css, etc. except .aspx files.
When a missing .aspx file is requested, .NET ignores IIS and uses this web.config setting instead:
That's well and good, but I don't want it to redirect. ie. I don't want the URL changed to this, eg:
/custom404.aspx?aspxerrorpath=/missingfile.aspx
I want it to stay like this, as it does for other missing files, eg:
/missingfile.html
So the question is: How do I tell .NET to handle missing .aspx files without redirecting and changing the browser's URL?
A solution would be vastly appreciated!
In my .net application, I want to handle 404 errors in the "normal" way that IIS handles them for all files.
So I set up a custom 404 file in ISS as normal. For example, my custom error file is "/custom404.aspx":

This works fine for missing files of all types - html, css, etc. except .aspx files.
When a missing .aspx file is requested, .NET ignores IIS and uses this web.config setting instead:
Code:
<customErrors mode="On">
<error statusCode="404" redirect="~/custom404.aspx" />
</customErrors>
That's well and good, but I don't want it to redirect. ie. I don't want the URL changed to this, eg:
/custom404.aspx?aspxerrorpath=/missingfile.aspx
I want it to stay like this, as it does for other missing files, eg:
/missingfile.html
So the question is: How do I tell .NET to handle missing .aspx files without redirecting and changing the browser's URL?
A solution would be vastly appreciated!