Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AspxErrorPath in Custom Error Page

We currently has a page that is used to display a generic error message when errors occur on our website. It has no functionality at all other than displaying a label that mentions there was an error.

Here is my issue, our client has ran a security review and tells us our error page contains phishing due to the URL in the query string, now I don't consider this a problem, but to put an end to the question, I'd like to remove the query string.

My web.config entry is this:

<customErrors mode="On" defaultRedirect="~/DefaultErrorPage.aspx">
</customErrors>

When an error occurs, it goes to DefaultErrorPage.aspx?aspxerrorpath=/Website1/LastPage.aspx

How can I prevent this? However, I could just redirect to the page if it contains the query, but I'm more looking for a way to prevent the query string instead of an extra redirection.

like image 492
jaekie Avatar asked Jan 18 '11 16:01

jaekie


People also ask

What is Aspxerrorpath?

The aspxerrorpath parameter is passed if the error was caught by . NET (and the error page specified in web. config is used). This happens if you're using the development web server, or if IIS is configured not to check that the file exists.

Which of the following attribute of the customErrors section is used to show custom error page in asp net?

The <customErrors> section in Web. config has two attributes that affect what error page is shown: defaultRedirect and mode . The defaultRedirect attribute is optional. If provided, it specifies the URL of the custom error page and indicates that the custom error page should be shown instead of the Runtime Error YSOD.


1 Answers

you could catch/handle all errors in your global.asax file instead and do the redirect there

    protected void Application_Error(object sender, EventArgs e)
    {
        //Exception ex = Server.GetLastError();

        Server.Transfer("~/DefaultErrorPage.aspx");
    }
like image 172
jumpdart Avatar answered Sep 21 '22 13:09

jumpdart