The Artima Developer Community
Sponsored Link

.NET Buzz Forum
Programmatically determine what version of ASP.NET you're running

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Scott Hanselman

Posts: 1031
Nickname: glucopilot
Registered: Aug, 2003

Scott Hanselman is the Chief Architect at Corillian Corporation and the Microsoft RD for Oregon.
Programmatically determine what version of ASP.NET you're running Posted: Oct 15, 2004 11:05 PM
Reply to this message Reply

This post originated from an RSS feed registered with .NET Buzz by Scott Hanselman.
Original Post: Programmatically determine what version of ASP.NET you're running
Feed Title: Scott Hanselman's ComputerZen.com
Feed URL: http://radio-weblogs.com/0106747/rss.xml
Feed Description: Scott Hanselman's ComputerZen.com is a .NET/WebServices/XML Weblog. I offer details of obscurities (internals of ASP.NET, WebServices, XML, etc) and best practices from real world scenarios.
Latest .NET Buzz Posts
Latest .NET Buzz Posts by Scott Hanselman
Latest Posts From Scott Hanselman's ComputerZen.com

Advertisement

Here's a goodness from Doug Seven and various KBs. Thanks! 

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

<script language="C#" runat="server">
void Page_Load (Object sender, EventArgs e) {

//Microsoft .NET Framework 1.0 (no service pack) 1.0.3705.000
//Microsoft .NET Framework 1.0 Service Pack 1 (SP1) 1.0.3705.209
//Microsoft .NET Framework 1.0 Service Pack 2 (SP2) 1.0.3705.288
//Microsoft .NET Framework 1.0 Service Pack 3 (SP3) 1.0.3705.6018

string servicePack = "";
if(Environment.Version.Build==3705)
{
  switch(Environment.Version.Revision)
  {
  case 209:
  servicePack = "SP1";
  break;
  case 288:
  servicePack = "SP1";
  break;
  case 6018:
  servicePack = "SP1";
  break;
  }
}
else if(Environment.Version.Build==4322)
{
  using(
  Microsoft.Win32.RegistryKey regKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\NETFramework Setup\NDP\v1.1.4322"))
  {
    if(regKey.GetValue("SP").ToString() =="1")
       servicePack = "SP1";
  }
}

//HKEY_LOCAL_MACHINE\Software\Microsoft\NET FrameworkSetup\NDP\v1.1.4322
Output.Text = String.Format ("This page uses ASP.NET {0}.{1} {2}", Environment.Version.Major, Environment.Version.Minor, servicePack);
}
</script>

Now playing: Alicia Keys - If I Was Your Woman/Walk On By

Read: Programmatically determine what version of ASP.NET you're running

Topic: CopySourceAsHTML Previous Topic   Next Topic Topic: Imagine Cup 2005

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use