0

I'm trying to debug in VS express 2013 with my MVC4 application.

In a view, I've added a nonsense link, such as <a href="blah.asf">link,</a> but I don't see the intended View when I click on the link, I see the IIS page.

I did this by creating an ErrorController which is

public class ErrorController : Controller { public ActionResult Index() { return View(); } } 

My view remains as the default, I didn't update it.

And my webconfig is

 <customErrors mode="On" defaultRedirect="~/Error"> </customErrors> 

The routes are the default!

The IIS message is

HTTP Error 404.0 - Not Found 

If I type in http://localhost:53258/error/ then I see the page, suggesting that the mapping is fine.

What have I done wrong?

6
  • I'm not sure why you think that the only requirement to display an error is to create an ErrorController that is very much not the case. Commented Mar 31, 2015 at 16:35
  • Fair to assume that the ~/Error route is mapped? Commented Mar 31, 2015 at 16:37
  • @ErikPhilips, I don't, hence the update to the web.config and the view... Commented Mar 31, 2015 at 16:43
  • @NathanTaylor, I tested it (and updated post), the page renders when I go there by typing localhost:53258/error Commented Mar 31, 2015 at 16:44
  • possible duplicate of Custom Error Page does not show even though I set CustomError="On" Commented Mar 31, 2015 at 16:50

2 Answers 2

0

Check for this in your web.config, and add it if you don't have it:

<httpErrors errorMode="Custom" existingResponse="PassThrough" /> 
Sign up to request clarification or add additional context in comments.

1 Comment

I get an error of the existingResponse attribute is not allowed. I tried it, but it makes no difference
0

Try updating your customErrors node to add this:

<error statusCode="404" redirect="~/Error" /> 

Thus, your custom errors section would look like:

<customErrors mode="On"> <error statusCode="404" redirect="~/Error" /> </customErrors> 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.