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.
Handling 404 in Mvc 3
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
#1 Posted by friism Support staff on 21 May, 2011 07:13 PM
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 Posted by justinsoliz on 21 May, 2011 07:24 PM
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 Posted by friism Support staff on 23 May, 2011 12:15 AM
Can you provide a url where your application generates different results on your local machine than on AppHarbor?
#4 Posted by justinsoliz on 23 May, 2011 12:21 AM
http://www.justinsoliz.com/invalid
That should do the trick. I have added [support] as a collaborator as well.
#5 Posted by friism Support staff on 23 May, 2011 12:36 AM
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.csseems 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 inWindsorControllerFactory.GetControllerInstancethat handles 404 exceptions is never run.Let us know if you think this is not the case.
friism closed this discussion on 23 May, 2011 12:36 AM.
justinsoliz re-opened this discussion on 23 May, 2011 12:40 AM
#6 Posted by justinsoliz on 23 May, 2011 12:41 AM
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.
#7 Posted by friism Support staff on 23 May, 2011 01:50 AM
Apparently you need to set
TrySkipIisCustomErrors, see this Stackoverflow question.friism closed this discussion on 23 May, 2011 01:50 AM.
justinsoliz re-opened this discussion on 23 May, 2011 02:21 AM
#8 Posted by justinsoliz on 23 May, 2011 02:21 AM
Setting Response.TrySkipIisCustomErrors to True does fix the error. I appreciate the help.
justinsoliz closed this discussion on 23 May, 2011 02:21 AM.