开发者

Validating virtual directory UNC Connection

开发者 https://www.devze.com 2023-03-28 00:11 出处:网络
I need to validate开发者_运维问答 that the UNC connection credentials are valid and pass through authentication, for each virtual directory.

I need to validate开发者_运维问答 that the UNC connection credentials are valid and pass through authentication, for each virtual directory.

I'm using Microsoft.Web.Administration API to manage my IIS configurations. The API does exposes the Username and password for the UNC connection, but I can't find the test connection results (see screenshot).

Validating virtual directory UNC Connection

Is there a way to retrieve the test results via the API? If not, are you familiar of other approaches to the issue?


If you search a bit with .NET Reflector, you will find that the code behind this dialog is located in the Microsoft.Web.Management.Iis.dll assembly. This assembly is located in the GAC (if you use Reflector, just do File / Open Global Assembly Cache, and choose this DLL).

To be more precise, the code is implemented in a the Microsoft.Web.Management.Iis.WebObjects.WebObjectsTestConnectionHelper class, method public PropertyBag TestConnection(PropertyBag bag).

Unfortunately this class is non public, as the code is quite specific to IIS, and not a general "unc connection testing code". However, the whole implementation is located here, so you can really understand what it's doing by looking at it using Reflector and 1) reproduce it using your own code, or 2) call it using reflection mechanisms. What must be in the input PropertyBag can be determined by looking at the method (and sub methods) body.

0

精彩评论

暂无评论...
验证码 换一张
取 消