How to set default errorpage for httpErrors?
I want to specify default error page for all status codes
in the web.config
<httpErrors errorMode="Custom" existingResponse="Replace">
<remove statusCode="404" />
<remove statusCode="500" />
<error statusCode="500" responseMode="ExecuteURL" path="/CustomError/ServerError" />
<error statusCode="404" responseMode="ExecuteURL" path="/CustomError/NotFound" />
</httpErrors>
I tried to set the 'defaultPath' in httperrors tag
<httpErrors errorMode="Custom" existingResponse="Replace" defaultPath="/CustomError/default">
any advise ??
thanks in advance
Edit: Note, I am asking about httpErrors not about customErrors the reason why I am using httperros, because I don't want to redirect, I want to stay under the same url.
Edit: Here is the error controller:
public class CustomErrorController : DefaultBaseController
{
public ViewResult ServerError()
{
var masterPageName = new SitePageBuilder(SiteId).GetMasterPageName("/");
return this.View("ServerError", masterPageName);
}
public ViewResult NotFound()
{
var masterPageName = new SitePageBuilder(SiteId).GetMasterPageName("/");
return this.View("NotFound", masterPageName);
}
}