I have tried to set up a Custom 404 page, and it is redirecting to that URL. However, it's not showing the page it should be. IIS 6
So, I have the web.config setting AND I'm returning a 404 code on the NotFound.aspx page.
Web.config
<customErrors mode="RemoteOnly" defaultRedirect="~/error/Default.aspx">
<error statusCode="404" redirect="~/error/NotFound.aspx" />
</customErrors>
NotFound.aspx.cs
public partial class error_NotFound : Custom.PageBase
{
protected void Page_Load(object sender, EventArgs e)
{
Response.StatusCode = 404;
}
}
You can see here that this:
https://www.mshsaa.org/notapage.aspx
...redirects to this:
https://www.mshsaa.org/error/NotFound.aspx?aspxerrorpath=/notapage.aspx
NOTE This does appear to work correctly on my local machine, but not on live.
NOTE2 I see that there is also an IIS setting for a 404 Error that redirects.
So, what am I doing wrong?
redirectMode="ResponseRewrite"
tocustomErrors
. – Alex Kudryashev