Hi folks,
I've got some custom error handling in my ASP.NET MVC site -> seems to be working fine.
I have an Error Controller, like this :-
/Controller/ErrorController.cs
[AcceptVerbs(HttpVerbs.Get)]
public ActionResult Unknown()
{
Response.StatusCode = (int)HttpStatusCode.InternalServerError;
return View("Error");
}
[AcceptVerbs(HttpVerbs.Get)]
public ActionResult NotFound()
{
Response.StatusCode = (int)HttpStatusCode.NotFound;
return View("Error");
}
(i've also removed some other text, like the message to display, etc..)
The view is located like..
/Views/Error/Error.aspx
Now, i'm not sure how I can 'call' the Unknown
method (above) when an error occurs. I thought I could use the [HandleError]
attribute, but this only allows me to specify a View (and I'm don't think i'm doing that properly, cause the error url is really weird).