Consider the following scenario:
In this scenario, the webpage is not redirected as expected.
For example, you build a default.aspx webpage that contains a button. The webpage contains the following code under the Button click event.
When a request accesses the default.aspx webpage and then the button is clicked, a POST request is submitted. HTTP code 302 is logged, and the webpage is redirected successfully to the hello.aspx webpage.
In this example, the IIS log contains an entry that resembles the following for the POST request:
However, if lots of GET requests access the default.aspx?id=1 webpage and the IIS cache is built up, you are not redirected to the hello.aspx webpage when you click the button on the default.aspx webpage. Instead, an HTTP code 200 is logged in the IIS log. The STTP code 200 resembles the following:
- In Microsoft Internet Information Services (IIS) 7.0 or in IIS 7.5, you have a webpage in an application that accepts a POST request and then redirects to a different webpage.
- You enable output caching on the application, and the cache is built up after you send GET requests to the webpage together with parameters.
- A POST request is sent to the webpage.
In this scenario, the webpage is not redirected as expected.
For example, you build a default.aspx webpage that contains a button. The webpage contains the following code under the Button click event.
protected void Button1_Click(object sender, EventArgs e)
{
Response.Redirect("./hello.aspx", false);
}
When a request accesses the default.aspx webpage and then the button is clicked, a POST request is submitted. HTTP code 302 is logged, and the webpage is redirected successfully to the hello.aspx webpage.
In this example, the IIS log contains an entry that resembles the following for the POST request:
#Fields: datetime s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) sc-status sc-substatus sc-win32-status time-taken
datetime ::1 POST /folder_name/default.aspx id=1 80 - ::1 Mozilla/5.0+(compatible;+MSIE+9.0;+Windows+NT+6.1;+WOW64;+Trident/5.0) 302 0 0 6
datetime ::1 POST /folder_name/default.aspx id=1 80 - ::1 Mozilla/5.0+(compatible;+MSIE+9.0;+Windows+NT+6.1;+WOW64;+Trident/5.0) 302 0 0 6
However, if lots of GET requests access the default.aspx?id=1 webpage and the IIS cache is built up, you are not redirected to the hello.aspx webpage when you click the button on the default.aspx webpage. Instead, an HTTP code 200 is logged in the IIS log. The STTP code 200 resembles the following:
#Fields: datetime s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) sc-status sc-substatus sc-win32-status time-taken
datetime ::1 POST /folder_name/default.aspx id=1 80 - ::1 Mozilla/5.0+(compatible;+MSIE+9.0;+Windows+NT+6.1;+WOW64;+Trident/5.0) 200 0 0 6
datetime ::1 POST /folder_name/default.aspx id=1 80 - ::1 Mozilla/5.0+(compatible;+MSIE+9.0;+Windows+NT+6.1;+WOW64;+Trident/5.0) 200 0 0 6