Show the Customized Error page in Production phase, not Test phase RRS feed

  • Question

  • User-1187675394 posted

    I have used the code from the the page "http://benfoster.io/blog/aspnet-mvc-custom-error-pages" in order to create a customized error message.

    However forgot about that the the customized error page should be displayed only in production phase, not in test development phase. If I retreive a error message in test development I would like to read the error message, not reading the customized error page.

    Do you know guys how I should do it?

    I'm using ASP.net mvc 4.


    Monday, April 11, 2016 8:26 PM


  • User2053451246 posted

    If you mean debugging on your local computer, put this in the <system.web> node of your Web.config file:

    <customErrors mode="RemoteOnly"></customErrors>

    If you mean when the site is hosted on a remote test server, look into Web.config transforms.  I can change sections of your Web.config file when you publish the site:


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, April 11, 2016 8:42 PM