locked
Throw Response status 503 - but yet show custom error page RRS feed

  • Question

  • In my application I have to show a custom error page when there is an application error. In the mean time I want to throw Response status code 503 and not allow IIS to throw the custom message. I have written code to in Global.asax method - "Application_Error" to redirect the error page when there is an application error. 

    Application is ASP.Net 3.5

    This is my code in the error page

                Response.StatusCode = 503;
                Response.StatusDescription = "HTTP/1.1 503 Page Temporarily Unavailable";
                Response.Expires = -1;
                Response.ExpiresAbsolute = DateTime.Now.AddHours((double)-1);
                Response.AppendHeader("Cache-Control", "no-cache, no-store, must-revalidate");
                Response.TrySkipIisCustomErrors = true;
                Response.Flush();

    Okay, the issues I am facing are

    1) On an exception error page comes with "MY error page content" + "The Service is unavailable" at the top of the page. (strangely this issue is not there in development server but exists on Staging server Win ser 2008)

    2) Error in MVC pages are not controlled and directly "The Service is unavailable" is being shown. 

    The Application pool IIS set to is classic mode.

    Can someone point what could be the issue ??



    KingCobra [BalaVikram]

    • Moved by Caillen Tuesday, October 29, 2013 7:29 AM ASP.NET question.
    Monday, October 28, 2013 2:21 PM

Answers

  • Hi,

    Since your question is about ASP.NET, I recommend that you post a new question in ASP.NET forum.

    More experts will give you help there.

    Thanks for your understanding.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Proposed as answer by Just Karl Tuesday, October 29, 2013 2:30 PM
    • Marked as answer by Just Karl Friday, November 8, 2013 5:02 PM
    Tuesday, October 29, 2013 7:29 AM