How to Check Installed .NET Versions on Hosting Server in VB.NET
In this post, you will learn how to check the installed .NET versions on hosting server to avoid any uncertainty in development.
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" %>
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") &", "
<head id="Head1" runat="server">
<form id="form1" runat="server">
<asp:Label ID="lblVersion" runat="server">There is following versions installed and running: </asp:Label>
HAVE A HAPPY CODING !!