I’m trying to write some C# code to do administration on IIS.
I have an instance of Microsoft.Web.Administration.Application for my web application.
How can I use this object to get the same information as in IIS under “Authentication”?
I expect a list that contains something like:
- Anonymous Authentication (disabled)
- ASP.NET Impersonation (enabled)
- Forms Authentication (disabled)
- Windows Authentication (enabled)
Thanks in advance,
Stephen
Then use
…to get a list of sections. The authentication sections start with “system.webServer/security/authentication/”, so search for those sections.
Then call
The section for Anonymous Authentication is called “anonymousAuthentication”, and the section for Windows Authentication is “windowsAuthentication”.
There’s also Forms Authentication, which is explained further down. So the code looks something like this:
Here’s the code for Forms Authentication