Listing all installed programs on Hosting Server using ASP.NET


Introduction

Well, this is 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 or which software is installed on the hosting system and many more. But 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.

Code

<%@ Page Language="VB" %>
<%@ Import Namespace="Microsoft.Win32" %>
<%@ Import Namespace="System.Diagnostics" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
    Protected Sub Page_Load(ByVal sender As ObjectByVal e AsSystem.EventArgs)
        Dim soft As String ="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
        Using rk As RegistryKey = Registry.LocalMachine.OpenSubKey(soft)
            For Each skName As String In rk.GetSubKeyNames()
                Using sk As RegistryKey = rk.OpenSubKey(skName)          
                    ListBox1.Items.Add(sk.GetValue("DisplayName") + " " + sk.GetValue("DisplayVersion"))      
                End Using
            Next
        End Using
    End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <asp:Label ID="lblText" runat="server">Your server is running following applications: </asp:Label>
        <br /><br />
    <asp:ListBox ID="ListBox1" runat="server" Height="613px" Width="729px" />
    </form>
</body>
</html>

Comments

Popular posts from this blog

Customize User's Profile in ASP.NET Identity System

Lambda two tables and three tables inner join code samples