Checking the Installed .NET Versions on Hosting Server

In this post, you will learn how to check the installed .NET versions on hosting server to avoid any uncertainty in development.
  • 1511


Well, that very tiny post but it is very useful when you wish to know the exact what your hosting provider supports. No need to ask them (hosting company) that which extension you support. By using couples of lines code-behind you can do it yourself. Let's look at the code which will make it possible.

I am using a single .aspx page with VB code-behind.


<%@ 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


    End Sub




<head id="Head1" runat="server">  

    <title>CLR Versions</title>



    <form id="form1" runat="server">

        <asp:Label ID="lblVersion" runat="server">There is following versions installed and running: </asp:Label>






More Articles

© 2020 DotNetHeaven. All rights reserved.