Custom error page issue RRS feed

  • Question

  • User154448021 posted

    In the web.config file, I have this line:

    <customErrors mode="RemoteOnly" defaultRedirect="~/Shared/Error"/>

    I have deployed the MVC app to Azure.  When I tried to view the error page by URL like this http://myazuresiteurl.azurewebsites.net/Shared/Error, I got returned url as http://myazuresiteurl.azurewebsites.net/Shared/Error?aspxerrorpath=/Shared/Error with this error: An exception occurred while processing your request. Additionally, another exception occurred while executing the custom error page for the first exception. The request has been terminated. 

    I checked online for solution and found one by suggesting to change the line in web.config file to 

    <customErrors mode="RemoteOnly" defaultRedirect="../Shared/Error"/>

    Although it does not return the original error any more, it returns a blank page, which is still not acceptable.  Could anybody help me with a solution?  Thank you very much in advance. 

    Friday, June 17, 2016 5:24 PM


  • User154448021 posted

    After reading the codes, I have understood why I got the error: "Shared" is not a controller but a folder name.  The routing requires a controller name instead.  I fixed this issue by adding the following code in Home controller:

            public ActionResult Error()
                return View();

    and change the line in web.config file to:

    <customErrors mode="RemoteOnly" defaultRedirect="~/Home/Error"/>

    Error view stays in Shared folder.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, June 18, 2016 12:49 AM