Search code examples
c#asp.nethttp-redirectiis-7post-redirect-get

Response.Redirect() disables back-button


As far as I understand, Response.Redirect("http://stackoverflow.com"); tells the browser to initiate a request to another URL.

One of the results of this is that the browser "remembers" the redirection, and allows pressing "back."

However, I have a website where Response.Redirect disables the ability to press the browser's "Back" button, as if the browser had opened a new window. (Browsing history is not forgotten, unlike with Server.Transfer.)

The redirection used to work properly in the past, so I suspect the problem has something to do with the IIS server (IIS7).

I apologize in advance if this question should be moved to ServerFault.com.

UPDATES:

  1. Here is some code:

    protected void btnClickMe_Click(object sender, EventArgs e)
    {
        // ...
        // some server-side logic
        // ...
    
        Response.Redirect("NewPage.aspx?ProductID=" + idNum);
    }
    
  2. Regarding "disables the ability to press the browser's 'Back' button", what I meant is that the button cannot be pressed. Same as when you open a new window. The button is gray, and clicking it has absolutely no effect.

UPDATE 2:

This has been tested with IE6 and IE8.


Solution

  • The problem was NOT with the Response.Redirect();.

    When I was on OldPage.aspx, I entered a new URL in the address bar. Once the browser loaded the new site, it disabled the back-button.

    Conclusion: There is something wrong with OldPage.aspx, not the redirection to NewPage.aspx.

    I still don't know why THIS happens, but this is an entirely different question.