.comment-link {margin-left:.6em;}

I Hate Linux

Wednesday, October 31, 2007

WHS Developer Tip #1: Web Site Status

Q: How can I programmable determine if the WHS Remote Access Web Site(s) are enabled or not?

A: When a user first enables the WHS Web Sites through the Home Server Console, the HKLM\Software\Microsoft\Windows Home Server\Website Manager registry key is created and contains a single value named Connectivity which is set to 1 when the sites are enabled and 0 if the sites are disabled.

A slightly more programmatic method is to check the value of RemoteAccessConfig.IsAppPoolEnabled (located in the Microsoft.HomeServer.RemoteAccess.Utilities namespace and the WHSCommon.dll assembly).

True if the sites are enabled, false if not.

Edit: I goofed, RemoteAccessConfig.IsAppPoolEnabled right away, even if the web site is turned off and only returns false after the web sites have been turned on and then off again... which means the regkey is the current best bet.

Note: The information in this post is based on undocumented and at times deduced information on Windows Home Server and is not officially supported or endorsed by Microsoft and could very easily be wrong or subject to change in future, so please take it and everything else said on this blog with a grain of salt and use with caution.



Post a Comment

<< Home