Microsoft KB Archive/839521

= FIX: The Server.Transfer method causes a stack overflow and causes the ASP.NET worker process to stop responding =

Article ID: 839521

Article Last Modified on 12/3/2007

-

APPLIES TO


 * Microsoft .NET Framework 1.1 Service Pack 1

-





SYMPTOMS
Note Microsoft Visual C++ .NET 2002 and Microsoft Visual C++ .NET 2003 support both the managed code model that is provided by the Microsoft .NET Framework and the unmanaged native Microsoft Windows code model. The information in this article applies only to unmanaged Visual C++ code.When you run a Web-based application that is based on the Microsoft .NET Framework 1.1, you receive an error message when the following conditions are true:
 * Your Web-based application calls the Server.Transfer method to transfer to the same page.
 * You are sending a POST request through the Server.Transfer method.
 * You have applied the hotfix that is described in Microsoft Knowledge Base article 837132 or a later version of the hotfix.

The following is the error message that you receive:

An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll

After you receive the error message, the ASP.NET worker process stops responding.



CAUSE
This problem occurs because the Server.Transfer method loops back to the same page until all the stack space is exhausted. The Server.Transfer method loops back to the same page because the query string is preserved between each POST request.



Service pack information
The issue that is listed in the &quot;Symptoms&quot; section when calling the Server.Transfer(same page) method with no additional parameters is addressed by installing this service pack.

Note When you call Server.Transfer(same page, true) without additional code, a stack overflow occurs. This behavior is by design. When you need both forms and query data, see the table in the &quot;More Information&quot; section of this article for guidance about how to handle this situation. To avoid this error, add code that is similar to the following:

Visual C# .NET if (IsPostBack) {       if (Context.Items[&quot;Transferred&quot;] == null) {    // Initialize to prevent stackover Context.Items[&quot;Transferred&quot;] = new object; // TransferToSelf Server.Transfer(&quot;Webform1.aspx&quot;, true); } } Visual Basic .NET Webform1 If IsPostBack Then If Context.Items(&quot;Transferred&quot;) is Nothing 'Initialize to prevent stackover Context.Items(&quot;Transferred&quot;) = new object 'TransferToSelf Server.Transfer(&quot;WebForm1.aspx&quot;, true) End If End If

Hotfix information
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 Microsoft .NET Framework 1.1 service pack 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:

http://support.microsoft.com/contactus/?ws=support

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.

Prerequisites
No prerequisites are required.

Restart requirement
You do not have to restart your computer after you apply this software update.

Hotfix replacement information
This hotfix does not replace any other hotfixes.

File information
The English version of this hotfix has the file attributes (or later file attributes) 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 -- 31-Mar-2004 22:45  1.1.4322.1017     258,048  Aspnet_isapi.dll 31-Mar-2004 22:45  1.1.4322.1017      20,480  Aspnet_regiis.exe 31-Mar-2004 22:45  1.1.4322.1017      32,768  Aspnet_state.exe 31-Mar-2004 22:45  1.1.4322.1017      32,768  Aspnet_wp.exe 27-May-2003 19:00                     33,522  Installpersistsqlstate.sql 27-May-2003 19:00                     34,150  Installsqlstate.sql 30-Mar-2004 23:41                     35,017  Installsqlstatetemplate.sql 18-Jan-2004 08:55  1.0.3705.0        106,496  Netfxupdate.exe 31-Mar-2004 22:45  1.1.4322.1017      94,208  Perfcounter.dll 18-Jan-2004 08:55  1.1.4322.573      102,400  Setregni.exe 02-Feb-2004 16:43                      8,571  Smartnav.js 31-Mar-2004  22:44  1.1.4322.1017   1,220,608  Sy52106.dll 31-Mar-2004 22:44  1.1.4322.1017     241,664  System.messaging.dll 31-Mar-2004 22:44  1.1.4322.1017     323,584  System.runtime.remoting.dll 31-Mar-2004 22:44  1.1.4322.1017     131,072  System.runtime.serialization.formatters.soap.dll 31-Mar-2004 22:44  1.1.4322.1017   1,257,472  System.web.dll 31-Mar-2004 22:44  1.1.4322.1017     819,200  System.web.mobile.dll 31-Mar-2004 22:45  1.1.4322.1017     569,344  System.web.services.dll 31-Mar-2004 22:45  1.1.4322.1017   1,339,392  System.xml.dll 18-Jan-2004 08:55  1.1.4322.573      118,784  Togac.exe 30-Mar-2004 23:41                      2,119  Uninstallsqlstatetemplate.sql 02-Feb-2004 16:43                     14,482  Webuivalidation.js 17-Mar-2004  09:10                        271  Branches.inf 31-Mar-2004 23:18                     17,125  Kb839521.cat 31-Mar-2004 23:07                        354  Updatebr.inf 31-Mar-2004 23:08                     11,734  Update_rtmqfe.inf



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the &quot;Applies to&quot; section.



MORE INFORMATION
This hotfix introduces some new behavior in the Server.Transfer method. The following table describes the results that occur when you send a POST request through the Server.Transfer method by using different parameters.

Steps to reproduce the problem
 Install the hotfix that is described in Microsoft Knowledge Base article 837132, or a later version of the hotfix. In Microsoft Visual Studio .NET, create a new Visual Basic ASP.NET Web Application project. Click Button in the Toolbox, and then draw a button on the WebForm1.aspx page. Name the new button Button1.  Double-click Button1, and then add the following code to the Button1_Click event: If IsPostBack Then Server.Transfer(&quot;WebForm1.aspx&quot;) End If  Run the solution, and then click Button1.</li></ol>

For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

824684 Description of the standard terminology that is used to describe Microsoft software updates

For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

837132 FIX: WebService objects queue up and CPU utilization may increase unexpectedly in the .NET Framework 1.1

Additional query words: hangs

Keywords: kbqfe kbhotfixserver kbbug kbfix kbnetframe110presp1fix KB839521

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.