How Can I Redirect To Error Page For Any Specific Error ?
In my ASP.NET site, I want to redirect to the error page if any specific error comes from any page.
Is there any better option to do the same without checking for errors on each page
Add comment
Answers (1)
Add AnswerHere is the solution. It seems when you have a location specific customError directive; if you leave the defaultRedirect as “”, it will default to the sitewide defaultRedirect URL.
The solution was simply to turn off CustomError handling for this specific path, like so:
<system.web> <customErrors defaultRedirect="/Account/ErrorPage" mode="RemoteOnly"> <error statusCode="404" redirect="/Account/ErrorPage" /> //Your File Path </customErrors> </system.web>