FIX: Server.Transfer Does Not Invoke IsPostBack in .NET Framework 1.1 (821758)



The information in this article applies to:

  • Microsoft .NET Framework
  • Microsoft ASP.NET (included with the .NET Framework 1.1)
  • Microsoft Visual Studio .NET (2003), Professional Edition
  • Microsoft Visual Studio .NET (2003), Enterprise Developer Edition
  • Microsoft Visual Studio .NET (2003), Enterprise Architect Edition

SYMPTOMS

The Server.Execute method or the Server.Transfer method do not appear to work with the HttpContext.RewritePath method under the .NET Framework version 1.1. The Server.Execute or the Server.Transfer methods may break applications that rely on the functionality of the HttpContext.RewritePath method. On the page that receives a Server.Transfer method or a Server.Execute method, ASP.NET component model processing is not fully executed and postbacks are never achieved. In a 1.0 postback, if you tell the transfer to persist the Forms collection and the QueryString property (for example, Server.Transfer("WebForm1.aspx", true)), and then you transfer the page back to itself, the page goes through the same life cycle and sets the IsPostBack property to true again. In a 1.1 postback, in the same scenario, the IsPostBack property is set to false.

CAUSE

From version 1.0 to 1.1 of the .NET Framework, Server.Transfer behaves differently.

In version 1.0, Server.Transfer("WebForm1.aspx", true) preserves the Forms collection and the QueryString property, and considers the Transfer method as part of a postback. Therefore, the Page.IsPostBack property is set to true.

In version 1.1, the transfer is not considered part of the postback and Page.IsPostBack is set to false even if Server.Transfer transfers back to itself.

MORE INFORMATION

To reproduce the error that is described in this article, use the following code and steps:
  1. Create an ASP.NET Web application, add a Web button anywhere on the page without renaming the button, and then modify the code in the WebForm1.aspx file to reflect the following changes:
    		private void Page_Load(object sender, System.EventArgs e)
    		{
    			// Put user code to initialize the page here.
    			if (Page.IsPostBack)
    			{
    				Response.Write("PostBack.");
    			}
    		}
    
    
    		private void Button1_Click(object sender, System.EventArgs e)
    		{
    			Server.Transfer("WebForm1.aspx",true);
    		}
    	
  2. On .NET Framework 1.0, compile the project.
  3. Set breakpoints on the following lines of the code-behind page for Webform1.aspx:
    if (Page.IsPostBack) 
    
    Server.Transfer("WebForm1.aspx",true);
  4. To start the project with debugging, press F5, and then step through the code. You go into an infinite loop when you step through the code. This is the expected behavior because the value of IsPostBack is always true.

RESOLUTION

How to Obtain the Hotfix

This issue is fixed in the June 2003 Hotfix Package ASP.NET 1.1. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

821156 ASP.NET 1.1 June 2003 Hotfix Rollup Package



Important This hotfix contains two types of packages:
  • A Microsoft Windows Installer package
  • An Optional Component Manager (OCM) package
If you use Microsoft Windows Server 2003, you must specify that you require the Windows Server 2003 (OCM) update. If you use an operating system that is different from Windows Server 2003, you must continue to use the Windows Installer package. For Windows Server 2003, Windows File Protection monitors the .NET Framework 1.1 files.

This hotfix is not available individually. You can only receive it as a part of the rollup. When you request hotfix 821758, hotfix 821156 is returned.

A supported hotfix is now available from Microsoft, but it is only intended to correct the problem that is described in this article. Only apply it to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next .NET Framework Service Pack 1 for Framework Version 1.1 that contains this hotfix.

To resolve this problem immediately, contact Microsoft Product Support Services to obtain the hotfix. For a complete list of Microsoft Product Support Services telephone numbers and information about support costs, visit the following Microsoft Web site:Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.A supported hotfix is now available from Microsoft, but it is only intended to correct the problem that is described in this article. Only apply it to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next .NET Framework service pack 1 that contains this hotfix.

To resolve this problem immediately, contact Microsoft Product Support Services to obtain the hotfix. For a complete list of Microsoft Product Support Services telephone numbers and information about support costs, visit the following Microsoft Web site:Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

The English version of this fix has the file attributes (or later) that are listed in the following table. The dates and times for these files are listed in coordinated universal time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.
Date         Time   Version       Size       File name
-----------------------------------------------------------------------
07-Jun-2003  00:44  1.1.4322.910    253,952  Aspnet_isapi.dll
07-Jun-2003  00:44  1.1.4322.910     20,480  Aspnet_regiis.exe
07-Jun-2003  00:44  1.1.4322.910     32,768  Aspnet_wp.exe
15-May-2003  23:49                   33,522  Installpersistsqlstate.sql
15-May-2003  23:49                   34,150  Installsqlstate.sql
07-Jun-2003  12:52  1.1.4322.910  1,216,512  System.dll
07-Jun-2003  00:39                   14,472  Webuivalidation.js
07-Jun-2003  12:52  1.1.4322.910  1,249,280  System.Web.dll

STATUS

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

Modification Type:MinorLast Reviewed:10/5/2005
Keywords:kbNetFrame100preSP3fix kbVSNET2003preSP1fix kbNetFrame110preSP1fix kbWebForms kbQFE kbcode kbfix kbBug KB821758 kbAudDeveloper