Skip navigation

Run ASP.NET 1.0 and 1.1 Side by Side

Is it possible to run some apps under version 1.1 and others under version 1.0 on the same Web server?

AskthePRO

LANGUAGES: C#

ASP.NET VERSIONS: 1.0 | 1.1

 

Run ASP.NET 1.0 and 1.1 Side by Side

Is it possible to run some apps under version 1.1 and others under version 1.0 on the same Web server?

 

By Jeff Prosise

 

Editor's Note: This question is excerpted from the February 2004 issue of asp.netPRO. You can get more great questions and answers from Jeff Prosise in each issue of asp.netPRO by subscribing at http://www.aspnetPRO.com.

 

Q: Can ASP.NET 1.0 and 1.1 run side by side? More to the point, is it possible to run some ASP.NET apps under version 1.1 and others under version 1.0 on the same Web server? And can an application programmatically determine the version of ASP.NET that hosts it?

 

A: Yes, yes, and yes. That was easy, wasn't it? Seriously, though, ASP.NET 1.0 and 1.1 coexist very well on the same server. You'll find helpful information at http://www.asp.net/faq/SideBySide.aspx. Here, however, is a synopsis.

 

By default, installing version 1.1 of the .NET Framework configures existing ASP.NET applications to use ASP.NET 1.1. You can revert a specific application to ASP.NET 1.0 by changing the version of Aspnet_isapi.dll that the application is mapped to in the IIS metabase from 1.1.4322 to 1.0.3705. The easy way to do that is to run the Aspnet_regiis utility that comes with version 1.0 of the .NET Framework. This Aspnet_regiis command configures the application in the MyApp virtual directory to use ASP.NET 1.0:

 

Aspnet_regiis -sn w3svc/1/root/myapp

 

If you decide later to migrate the application to ASP.NET 1.1, simply repeat the command, but use the Aspnet_regiis utility that comes with version 1.1 this time.

 

As for detecting the ASP.NET version at run time, the code in Figure 1 contains the source for a page that does just that.

 

<html>

  <body>

    <h1><asp:Label ID="Output" RunAt="server" /></h1>

  </body>

</html>

 

<script language="C#" runat="server">

void Page_Load (Object sender, EventArgs e)

{

    Output.Text = String.Format (

        "This page is using ASP.NET {0}.{1}",

        Environment.Version.Major,

        Environment.Version.Minor

    );

}

</script>

Figure 1. This page displays the version of ASP.NET that hosts it.

 

It uses the Framework's static Environment.Version property to grab the major and minor version numbers. Should you need them, build and revision numbers are also present in the System.Version object the property's get accessor returns.

 

Jeff Prosise is the author of several books, including Programming Microsoft .NET (Microsoft Press, 2002). He's also a cofounder of Wintellect (http://www.wintellect.com), a software consulting and education firm that specializes in .NET. Have a question for this column? Submit queries to [email protected].

 

 

 

 

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish