1

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.

3
  • It looks as though the Url that returns is correct; have you created the 404.aspx page in your project? Commented Aug 2, 2012 at 15:13
  • Yes I have its in the ErrorPages folder where ErrorPage.aspx is (This Custom error works but only for webservice exceptions but does not work when I type the incorrect URL in) Commented Aug 2, 2012 at 15:15
  • Can you post the yellow screen of death screen shot Commented Aug 2, 2012 at 15:50

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

2 Comments

I tried that already. Which I don't think that is the problem cause the ErrorPage.aspx works for exception that occur on the webservice and that is in the same directory as the 404.aspx. The thing I don't understand is that the ErrorPage.aspx works for exceptions and even when i take out <error statusCode="404" redirect="~/ErrorPages/404.aspx /> The ErrorPage.aspx shows up when i type in the wrong URL. But when i put in the <error> tag the yellow screen of death comes up saying <customErrors mode="Off"> etc...
Can you post the details of what the yellow screen says?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.