Get IIS standard website path

Posted on 2005-05-02
Last Modified: 2012-08-13
Any idea how to retrieve the path of the standard website of IIS in ?
Like "c:\inetpub\wwwroot"

I want to replace some Xml stylesheets there with a windows program that is called after a .Net Webinstallation setup program via bootstrapper.

Question by:duke63
    LVL 62

    Accepted Solution


    The ,Net Framework has a class called RegistryKey. This class will permit you to read and write to the registry. IIS stores its information in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\InetStp and the parameter for the root directory in PathWWWRoot. You must have registry permission to access the registry.

            Dim hive As RegistryKey = Registry.LocalMachine    ‘ Opens the root key in the registory
            Dim subKey As RegistryKey                                    ‘ The path you wish to open
            Dim keyValue As String                                          ‘ The location of IIS Root

            ‘ Open path to IIS. The False in the statement means read only
            subKey = hive.OpenSubKey("SOFTWARE\Microsoft\INetStp", False)
            ‘ Read the location of the IIS root directory
            keyValue = CStr(subKey.GetValue("PathWWWRoot"))

    I hope this was of some help.

    -Fernando Soto

    Author Comment

    Indeed it was ;)

    Thanks FernadoSoto.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Article by: Kraeven
    Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
    I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now