ARTICLE

Accessing Registry using ASP.NET and VB.NET

Posted by Santhi Maadhaven Articles | Visual Basic 2010 July 08, 2005
In this article, we will see how to access the registry using ASP.NET. We will see one simple example to check where Visual Studio installed on our machine.
 
Reader Level:

In this article, we will see how to access the registry using ASP.NET. We will see one simple example to check where Visual Studio installed on our machine.

Microsoft provides namespace named Microsoft.Win32 which handles events raised by the operation system and manipulate the system registry. Some of the members that related to registry are

Registry Class - This class contains base RegisterKey that access values and subkeys in the registry.

RegistryKey Class - This class represents a key level node in the windows registry.

RegistryHive Enumeration - This represents possible top-level nodes on a foreign machine.

Sample :

Import Microsoft.Win32 in your code-behind file.

Imports Microsoft.Win32.

On Page_Load ,add the below lines.

Dim objRk As RegistryKey = Registry.LocalMachine.OpenSubKey("SOFTWARE").OpenSubKey("Microsoft").OpenSubKey("VisualStudio").OpenSubKey("7.1")Response.Write(objRk.GetValue("InstallDir").ToString())

This will return the path where your visual studio is installed.

Hope you will find this article interesting and useful.

NOTE: THIS ARTICLE IS CONVERTED FROM C# TO VB.NET USING A CONVERSION TOOL. ORIGINAL ARTICLE CAN BE FOUND ON C# CORNER (WWW.C-SHARPCORNER.COM).

share this article :
post comment
 
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor
PREMIUM SPONSORS
  • The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
    The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor