locked
Custom Error Page Implementation RRS feed

  • Question

  • Hi

    I am trying to implement a custom error page , which will be shown whenever there is some error on the website.

    I tried using underlying settings in web.config file.

    <customErrors mode="On" defaultRedirect="Error.html" redirectMode="ResponseRedirect">
            <error statusCode="404" redirect="Error.html" />
            <error statusCode="500" redirect="Error.html" />
        </customErrors>

    but it is giving me a runtime error and redirecting my URL to error.html?aspxerrorpath=/ instead of error.html

    Can somebody help me with this.

    Regard's
    Mohit Paul
    • Moved by Kristin Xie Wednesday, June 17, 2015 6:40 AM Asp.Net related
    Tuesday, June 16, 2015 6:23 AM

Answers

  • Hi Spiri

    Thanks for your efforts to resolve the issue.

    Well, I posted this question in sitecore forum too as this was using sitecore CMS. They told me that there was a bug in the version of sitecore which i'am using, and i need to upgrade my version.

    I hope this will resolve my issue.

    Once again, thanks for looking into my issue and proposing a solution.

    Regard's

    Mohit Paul


    • Proposed as answer by Spiri91 Tuesday, June 16, 2015 9:52 AM
    • Marked as answer by Just Karl Tuesday, June 30, 2015 10:18 PM
    Tuesday, June 16, 2015 9:38 AM

All replies

  • on global.asax

    go to Application_Error then :

    protected void Application_Error(object sender, EventArgs e)
            {
                Exception ex = Server.GetLastError();
                 //do what you want here with the error..then
                Server.ClearError();
                Server.Transfer("~/error.aspx");
            }


    Hope it helps. Spiri

    Tuesday, June 16, 2015 6:32 AM
  • Hi Spiri

    Thanks for your help

    I tried to to use the above code, but unfortunately it did not work.

    I tried it with and without removing the custom error attribute from web.config, but in both cases it did not work.

    Regard's

    Mohit  Paul

    Tuesday, June 16, 2015 7:16 AM
  • Please post ASP.NET related questions in the ASP.NET forums: http://forums.asp.net
    Tuesday, June 16, 2015 7:27 AM
  • this means something is not wright.. this is the default method to threat an error in asp..

    we need more info..

    -> do you have the error page wright?

    -> remove the custom error from web config.

    -> did you insert this on global.asax?

    what error are you getting now. post a image here..


    Hope it helps. Spiri


    • Edited by Spiri91 Tuesday, June 16, 2015 8:21 AM
    Tuesday, June 16, 2015 7:28 AM
  • Hi Spiri

    Thanks for your efforts to resolve the issue.

    Well, I posted this question in sitecore forum too as this was using sitecore CMS. They told me that there was a bug in the version of sitecore which i'am using, and i need to upgrade my version.

    I hope this will resolve my issue.

    Once again, thanks for looking into my issue and proposing a solution.

    Regard's

    Mohit Paul


    • Proposed as answer by Spiri91 Tuesday, June 16, 2015 9:52 AM
    • Marked as answer by Just Karl Tuesday, June 30, 2015 10:18 PM
    Tuesday, June 16, 2015 9:38 AM
  • yes it was something suspicious about this ...

    glad it sorted out


    Hope it helps. Spiri

    Tuesday, June 16, 2015 9:52 AM