How to enable/Disable Forms Authentication in IIS
Question
I am building a setup package using the WIX tool. I have a requirement for enabling/disabling Forms Authentication for a particular virtual directory in IIS based on the user requirement. I have tried appcmd command but could not get it to work:
appcmd set config "Default Web Site/Test" /commit:WEBROOT /section:system.web/authentication /mode:Forms /commit:apphost
Please suggest...
Solution
Here is the code that worked for me..
To Enable Forms Authentication:
appcmd set config "Default Web Site/Test" /section:system.web/authentication /mode:Forms
To Disable Forms Authentication:
appcmd set config "Default Web Site/Test" /section:system.web/authentication /mode:Windows
Just removed /commit:WEBROOT
to get it work.
If I am Adding /commit:WEBROOT
the above code will work only for "Default Web Site" and not for "Default Web Site/Test"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow