?
Solved

Get IIS standard website path

Posted on 2005-05-02
2
Medium Priority
?
840 Views
Last Modified: 2012-08-13
Any idea how to retrieve the path of the standard website of IIS in vb.net ?
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.

Thanks...
0
Comment
Question by:duke63
2 Comments
 
LVL 64

Accepted Solution

by:
Fernando Soto earned 500 total points
ID: 13911571
Hi;

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"))
        hive.Close()

I hope this was of some help.

-Fernando Soto
0
 

Author Comment

by:duke63
ID: 13916213
Indeed it was ;)

Thanks FernadoSoto.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

839 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