BUG: Pressing ENTER on the URL Bar Does Not Reload a Posted Page (265843)



The information in this article applies to:

  • Microsoft Internet Explorer 5.01 for Windows NT 4.0
  • Microsoft Internet Explorer 5.0 for Windows NT 4.0
  • Microsoft Internet Explorer 5.0 for Windows 2000
  • Microsoft Active Server Pages

This article was previously published under Q265843

SYMPTOMS

Many Web sites use re-entrant ASP pages to implement a method known as "post-back" to process input that is submitted by users in HTML forms. The post-back method allows a form to be posted back to the same page that displays it. An ASP that implements this method to process form input is commonly known as a re-entrant ASP page. A HTTP_GET is invoked to initially display the form when the user enters the URL to the .asp or clicks on a hyperlink that points to it. When the form is filled out and submitted, the contents of the form elements are posted back to the same page by invoking a HTTP_POST. The ASP usually processes the input posted and generates a response HTML page as an acknowledgement to the user.

A convenient aspect of this method is that the URL displayed in the browser's address bar does not change during the entire process of displaying the input form, accepting user input, posting/processing the input, and displaying a response HTML page.

However, pressing the ENTER key on the browser's URL address bar when the POST version of the ASP page is displayed does not result in a reload on the GET version of the page that displays the blank input. Re-entering the URL in the address bar and pressing ENTER also results in a reload of the POST version of the page.

RESOLUTION

There are several workarounds for this problem:
  • Mouse-click the BACK button in the browser when the POSTED version of the page is displayed to issue a HTTP_GET that displays the empty form to accept fresh user input.
  • Include a hyperlink in the Response page generated by the POST operation that points back to the URL of the page. Click this hyperlink in the browser when the POST version of the page is displayed to reload the GET version and display the blank input form.
  • If the form was initially displayed by keying in the URL to access it, then selecting the URL from the drop-down portion of the browser's address bar results in a reload of the GET version of the page. NOTE: This needs to be done only once. Directly pushing ENTER on the URL address bar of the POSTED page for every subsequent POST has been noticed to initiate a reload of the GET version of the page.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Open a new text file in Notepad.
  2. Save the file as selfpost.asp in a virtual folder on your Internet Information Server (IIS).
  3. Copy and paste the following code in selfpost.asp:
    <%@Language=VBScript%>
    
    <HTML>
    <BODY>
    <%
    Response.write "Request Method : " & Request.ServerVariables("REQUEST_METHOD") & "<BR>"
    If Trim(Request.Form("txtName")) <> "" Then
      Response.Write "<BR>You Entered the Following Details : " & "<HR>"
      Response.Write "Name : " & Request.Form("txtName") & "<BR>"
      Response.Write "Email : " & Request.Form("txtEmail") & "<BR>"
      Response.Write "<HR>"
      Response.Write "<BR>"
      Response.End
    End If
    %>
    
    <FORM METHOD="POST" ACTION="selfpost.asp">
    
    Enter Your Name : <BR>
    <INPUT TYPE=text NAME=txtName> <BR><BR>
    
    Enter your E-mail address : <BR>
    <INPUT TYPE=text NAME=txtEmail> <BR><BR>
    
    <INPUT TYPE=submit Value="Submit">
    
    </FORM>
    
    </BODY>
    </HTML> 
    					
  4. Save the file again. Open the ASP in Internet Explorer 5 by typing in the URL to access it in the address bar. Note that a simple input form with fields to key in a name and an e-mail address is displayed.
  5. Enter some input into the two fields, and then click Submit. The form contents is now POSTED back to the same page that generates a Response page acknowledging the input that is submitted.

    Note that the URL that is displayed in the address bar does not change as the form is being posted back to the same page.
  6. Press ENTER after placing the cursor in the Address bar. Note that the GET version of the page that displays the blank form is not reloaded.
If the initial form was displayed by keying in the URL to access it as opposed to clicking a hyperlink that points to it, the URL entered is displayed in the drop-down portion of the address bar. Selecting this URL from the drop-down portion results in a re-load of the GET version of the page that displays the blank input form. Re-entering the URL in the address bar and pressing ENTER does not result in the GET version being reloaded.

Key in some input and resubmit the form to display the POST version of page. Pressing ENTER on the address bar this time results in the reload of the GET version as opposed to the first instance when the POSTED page was reloaded. If you navigated to the blank form initially by following a hyperlink, the URL is not listed in the drop-down portion of the address bar. In that case, you are not able to reproduce this specific behavior until you close down the browser and revisit the page by keying in its URL in the address bar.

A simple workaround as listed in the "Resolution" section of this article is to include a hyperlink that points to the URL of the re-entrant ASP page in the Response written out by the POST. Clicking the hyperlink when the posted page is displayed results in a reload of the GET version of the page. Copy and paste the following Response.End statement in the preceding code into the selfpost.asp file, and then test the modified page to evaluate the result:
Response.Write "<A href=selfpost.asp>Return to Form</A>"
				

Modification Type:MajorLast Reviewed:12/3/2003
Keywords:kbBug kbpending KB265843