asp.net-mvcmaster-pageshandleerror

How to use [HandleError] without Master Page


I am trying to use [HandleError] in MVC to redirect any un-handled exceptions to the "Error.aspx" page in the "Shared" folder. By default the Visual Studio 2010 MVC2 template creates a simple MVC application with this function. It works fine.

But the Error.aspx file created by default uses "Site.Master". But I do not want to use master page in my application. I deleted default "Error.aspx" and added my own. But it simply does not work. Anyone has any idea on how to use [HandleError] without Master page?

Thanks ...


Solution

  • Put your custome Error.aspx or your custome error page in shared views

     [HandleError(View = "Error")] // Or your custome error page name