custom error page in mvc

asp.net-mvc

Solution

In ASP.NET MVC error handling is normally specified using the HandleError attribute. By default, it uses a View named 'Error' to display the custom error page. If you just want to customize this View, you can edit Views/Shared/Error.aspx.

If you want a different View in particular cases, you can explicitly supply the View property.

Here's an example of a Controller action with a custom Error View:

[HandleError(View = "CustomError")]
public ViewResult Foo() 
{
    // ...
}

For global error handling in ASP.NET MVC, see this post.

Problem

I need to show up the error page using customerror on `web.config` But watever the error may be, even in web.config i specified some version wrong also it need to show the error page, How can I do this. I tried but url redirects to ``` "http://localhost:1966/Error.html?aspxerrorpath=Error.html" ``` CustomError Tag: ``` <customErrors mode="On" defaultRedirect="Error.html" /> ``` And shows up another error page from mvc, not mines.

Original source