Microsoft KB Archive/820106

= How To Specify a Version of the .NET Framework for an ASP.NET Web Application =

Article ID: 820106

Article Last Modified on 5/31/2007

-

APPLIES TO


 * Microsoft ASP.NET 1.1
 * Microsoft ASP.NET 1.0

-



IN THIS TASK

 * SUMMARY
 * Requirements
 * Create Two ASP.NET Web Applications
 * Configure the ASP.NET Version for Each Application
 * Verify the ASP.NET Versions
 * REFERENCES



SUMMARY
This step-by-step article describes how to specify the version of the .NET Framework to be used with ASP.NET Web application.

When multiple versions of ASP.NET are installed on a computer, you must indicate to Internet Information Services (IIS) the version of the ASP.NET ISAPI (Aspnet_isapi.dll) to use to process a page in an ASP.NET application. The ASP.NET ISAPI version that is associated with the ASP.NET application determines the version of the common language runtime that is used for the application.

An ASP.NET application is associated with an ASP.NET ISAPI version through a script map in IIS. To simplify the configuration process for an ASP.NET application, a linked version of Aspnet_regiis.exe is included with each version of ASP.NET.

back to the top

Requirements
The following list outlines the recommended hardware, software, network infrastructure, and service packs that are required:
 * ASP.NET 1.0 (included with the .NET Framework 1.0)
 * ASP.NET 1.1 (included with the .NET Framework 1.1)

To install the .NET Framework Redistributable package, do either of the following:  Download the .NET Framework Redistributable package, and then run Dotnetfx.exe. To download the .NET Framework Redistributable package, visit the following Microsoft Web site:

http://msdn2.microsoft.com/en-us/netframework/aa731542.aspx

 Install the redistributable file from the Windows Component Update CD-ROM or DVD-ROM. The redistributable file is located in the Wcu\dotNetFramework folder.

back to the top

Create an ASP.NET Web Application
 Start Microsoft Visual Studio .NET. Use Microsoft Visual C# .NET or Microsoft Visual Basic .NET to create a new ASP.NET Web Application project. Name the project AspVerApp1. By default, WebForm1.aspx is created. In Design view, right-click WebForm1, and then click View HTML Source.  Replace the existing HTML code with following code:

Visual C# .NET Sample Code <%@ Page language=&quot;c#&quot; %> <%@ Import Namespace = &quot;System&quot; %> <!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot; > <HTML> <HEAD> WebForm1 <script language=C# runat=server> public void Page_Load(object sender, System.EventArgs e)      {    Version vs = Environment.Version; Response.Write(&quot;ASP.NET version of this Application is :&quot; +vs.ToString); }  </HEAD> <body MS_POSITIONING=&quot;GridLayout&quot;> </HTML> Visual Basic .NET Sample Code <%@ Page language=&quot;vb&quot; %> <%@ Import Namespace = &quot;System&quot; %> <HTML> <HEAD> WebForm1 <script language= vb runat=server> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Dim vs As Version = Environment.Version Response.Write(&quot;ASP.NET version of this Application is :&quot; + vs.ToString) End Sub </HEAD> <body MS_POSITIONING=&quot;GridLayout&quot;> </HTML> </li> On the Build menu, click Build Solution.</li> Repeat steps 2 through 4 to create another ASP.NET Web Application named AspVerApp2 .</li></ol>

back to the top

Configure the ASP.NET Version for Each Application
In the path of the application, use the -s option or the -sn option of Aspnet_regiis.exe to set up the script maps. The script map points to the ASP.NET ISAPI version that is associated with Aspnet_regiis.exe.
 * Option -s installs the script map to all ASP.NET applications that are located at the specified application root path and in the corresponding subdirectories. This option updates all existing script maps in the specified path and the scripts that use earlier versions of ASP.NET ISAPI.
 * Option -sn installs the script map to the ASP.NET application that is located at the specified application root path. This option updates all existing script maps in the specified path that use earlier versions of ASP.NET ISAPI.

Note This option does not affect applications that are located in subdirectories of the specified path.

To configure AspVerApp1 to use ASP.NET 1.0, follow these steps: <ol> Click Start, and then click Run.</li> In the Open text box, type cmd, and then click OK.</li> At the command prompt, locate the following directory:

\Microsoft.NET\Framework\v1.0.3705\

</li> At the command prompt, type one of the following commands:  To Install ASP.NET 1.0 recursively

aspnet_regiis -s W3SVC/1/ROOT/AspVerApp1

-or-</li> To Install ASP.NET 1.0 non-recursively

aspnet_regiis -sn W3SVC/1/ROOT/AspVerApp1

</li></ul> </li></ol>

To configure AspVerApp2 to use ASP.NET 1.1, follow these steps: <ol> Click Start, and then click Run.</li> In the Open text box, type cmd, and then click OK.</li> At the command prompt, locate the following directory:

\Microsoft.NET\Framework\v1.1.4322\

</li> At the command prompt, type one of the following commands:  To Install ASP.NET 1.1 recursively

aspnet_regiis -s W3SVC/1/ROOT/AspVerApp2

-or-</li> To Install ASP.NET 1.1 non-recursively

aspnet_regiis -sn W3SVC/1/ROOT/AspVerApp2

</li></ul> </li></ol>

back to the top

Verify the ASP.NET Versions
<ol> <li>Start a browser such as Microsoft Internet Explorer.</li> <li>In the Address Bar of the browser, type the following URL to view the version number of the ASP.NET version that is associated with AspVerApp1:

http://localhost/AspVerApp1/WebForm1.aspx

Notice that the ASP.NET version that is associated with this application is 1.0.3705.0.</li> <li> In the Address Bar of the browser, type the following URL to view the version number of the ASP.NET version that is associated with AspVerApp2: http://localhost/AspVerApp2/WebForm1.aspx Notice that the ASP.NET version that is associated with this application is 1.1.4322.573 or the version of the .NET Framework 1.1 that is installed on your computer. </li></ol>

back to the top

<div class="references_section">