How To Specify a Version of the .NET Framework for an ASP.NET Web Application (820106)



The information in this article applies to:

  • Microsoft ASP.NET (included with the .NET Framework 1.1)
  • Microsoft ASP.NET (included with the .NET Framework) 1.0

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:
  • 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

  1. Start Microsoft Visual Studio .NET.
  2. 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.
  3. In Design view, right-click WebForm1, and then click View HTML Source.
  4. Replace the existing HTML code with following code:

    Visual C# .NET Sample Code
    <%@ Page language="c#"  %>
    <%@ Import Namespace = "System" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
    <HTML>
        <HEAD>
         <title>WebForm1</title>	
          <script language=C# runat=server>
    	   public void Page_Load(object sender, System.EventArgs e)
    	   {	Version vs = Environment.Version;
    		Response.Write("ASP.NET version of this Application is :" +vs.ToString());
    	   }
         </script>
       </HEAD>
     <body MS_POSITIONING="GridLayout">		
     </body>
    </HTML>
    Visual Basic .NET Sample Code
    <%@ Page language="vb"  %>
    <%@ Import Namespace = "System" %>
    <HTML>
       <HEAD>
        <title>WebForm1</title>	
         <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("ASP.NET version of this Application is :" + vs.ToString())
            End Sub
         </script>
     </HEAD>
     <body MS_POSITIONING="GridLayout">		
     </body>
    </HTML>
  5. On the Build menu, click Build Solution.
  6. Repeat steps 2 through 4 to create another ASP.NET Web Application named AspVerApp2.
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:
  1. Click Start, and then click Run.
  2. In the Open text box, type cmd, and then click OK.
  3. At the command prompt, locate the following directory:

    WindowsDirectory\Microsoft.NET\Framework\v1.0.3705\

  4. 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-
    • To Install ASP.NET 1.0 non-recursively

      aspnet_regiis -sn W3SVC/1/ROOT/AspVerApp1

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

    WindowsDirectory\Microsoft.NET\Framework\v1.1.4322\

  4. 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-
    • To Install ASP.NET 1.1 non-recursively

      aspnet_regiis -sn W3SVC/1/ROOT/AspVerApp2

back to the top

Verify the ASP.NET Versions

  1. Start a browser such as Microsoft Internet Explorer.
  2. 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.
  3. 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.
back to the top

REFERENCES

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

816782 How To Configure Different Versions of an ASP.NET Application Running on the Same Web Server

For more information, visit the following Microsoft Web site:

back to the top

Modification Type:MajorLast Reviewed:10/16/2006
Keywords:kbDeployment kbWebServer kbWebForms kbConfig kbHOWTOmaster KB820106 kbAudDeveloper