Checking .NET Framework version installed on webserver 

Monday, March 29, 2010 2:21:12 AM

To check your target web server environment for installed CLR versions you can use the follogin script which runs through the registry to determine the installes CLR versions on a host. Just paste the text below into a .aspx file. That' all.

<%@ Page Language="VB" %>
<%@ Import Namespace="Microsoft.Win32" %>

<script runat="server">
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim componentsKeyName As String = "SOFTWARE\Microsoft\NET Framework Setup\NDP"
        Dim componentsKey As RegistryKey = Registry.LocalMachine.OpenSubKey(componentsKeyName)
        Dim instComps As String() = componentsKey.GetSubKeyNames()
        For Each instComp As String In instComps
            Dim key As RegistryKey = componentsKey.OpenSubKey(instComp)
            If instComp IsNot Nothing AndAlso instComp.StartsWith("v") Then
                lblVersion.Text = lblVersion.Text & instComp & " SP " & key.GetValue("SP") & ", "
            End If
        Next
    End Sub
</script>

<html>
<head runat="server">   
    <title>CLR Versions</title>
</head>
<body>
    <form id="form1" runat="server">
        <asp:Label ID="lblVersion" runat="server">Your server is running ASP.NET and the versions are: </asp:Label>
    </form>
</body>
</html>





 



re: Checking .NET Framework version installed on webserver

Tuesday, April 13, 2010 4:38:43 AM Marcus Meisel

Das wollte ich schon immer wissen :-)

 

lg,

Marcus


Comments are closed on this post.

 
Site Map | Printable View | Design by creative & it consulting | © 2009 - 2012 Florian Morrenth