Pergunta

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). Unc Test connection

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

Foi útil?

Solução

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top