SpaceApple
SpaceApple

Reputation: 1327

ASP.NET CustomError 404

So I have basically setup a customError in the web.config which works fine when an exception occurs in the webservice, but now I want to add another customError which will look for an http 404 error. When the webservice gets an exception the ErrorPage.aspx CustomError works fine and when I enter an invalid URL the Yellow Screen Of Death comes up which I don't want, I want the 404.aspx error to come up.

Here is my code for the web.config

<customErrors mode="On" defaultRedirect="~/ErrorPages/ErrorPage.aspx">
  <error statusCode="404" redirect="~/ErrorPages/404.aspx" />
</customErrors>

This is the URL that returns when I type in the wrong URL

http://localhost:28745/ErrorPages/404.aspx?aspxerrorpath=/Accounfghogin.aspx

And this is the Yellow Screen Of Death I get when typing in the wrong URL

Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's configuration tag to point to a custom error page URL.

Upvotes: 1

Views: 1082

Answers (1)

SeaSharp
SeaSharp

Reputation: 186

Does it work if you try replacing the tildes (~) with the full path to the file?

Upvotes: 1

Related Questions