Archived Support Site

This support site is archived. You can view the old support discussions but you cannot post new discussions.

Handling 404 in Mvc 3

I seem to be getting an IIS 404 page instead of a custom error page. I'm not actually using customErrors in web.config and as such have it neither 'On' or 'Off' (which i believe might be the issue). Currently, I have a controllerfactory which catches an HttpException with a 404 Code and then invokes an ActionResult in the base Controller that handles logging and then returns a "NotFound" View. Obviously this works locally on IIS 7.5 but not sure what I'm missing. Thanks.

  1. You could definately try explicitly disabling customerrors in web.config. If that doesn't work, feel free to invite support(a)appharbor.com as a collaborator, and we can take a look.

  2. Disabling customErrors didnt seem to have any effect. I've added support as a collaborator, I'm not opposed to using customErrors, I was just trying out a new flow of error handling.

  3. Can you provide a url where your application generates different results on your local machine than on AppHarbor?

  4. http://www.justinsoliz.com/invalid

    That should do the trick. I have added [support] as a collaborator as well.

  5. I haven't tried to run this on AppHarbor, but it seems unlikely that your code works the way you describe, whether on AppHarbor or no. Your RouteDefinitions.cs seems to define a catch-all route named "NotFound" and the error-controller is chosen to handle request for http://www.justinsoliz.com/invalid. The codepath in WindsorControllerFactory.GetControllerInstance that handles 404 exceptions is never run.

    Let us know if you think this is not the case.

  6. friism closed this discussion on 23 May, 2011 12:36 AM.

  7. justinsoliz re-opened this discussion on 23 May, 2011 12:40 AM

  8. That is correct. I have since added the {*catchAll} to try and remedy the issue but the fact is that neither will work. My logging simply says "External Component" threw an error which isnt much help either.

  9. Apparently you need to set TrySkipIisCustomErrors, see this Stackoverflow question.

  10. friism closed this discussion on 23 May, 2011 01:50 AM.

  11. justinsoliz re-opened this discussion on 23 May, 2011 02:21 AM

  12. Setting Response.TrySkipIisCustomErrors to True does fix the error. I appreciate the help.

  13. justinsoliz closed this discussion on 23 May, 2011 02:21 AM.

Discussions are closed to public comments.
If you need help with AppHarbor please start a new discussion.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac