Reply to comment
Get Authentication Mode from Web.Config file
Submitted by Ben Hodson on Sun, 08/17/2008 - 21:00
If you want to find out programmatically what authentication mode the current ASP.NET website is running under you can actually read it from the web.config file using the code below.
System.Web.Configuration.AuthenticationSection section =
(System.Web.Configuration.AuthenticationSection)System.Web.Configuration.WebConfigurationManager.GetSection("system.web/authentication");if (section.Mode == System.Web.Configuration.AuthenticationMode.Windows){ // Do something because it is running under Windows mode}
else if (section.Mode == System.Web.Configuration.AuthenticationMode.None)
{ // Do something because it is running under None mode}
// etc.
If your web.config file's authentication section contained the following node:
<authentication mode="Forms">
</authentication>
Then the section.Mode would be:
section.Mode = System.Web.Configuration.AuthenticationMode.Forms

Recent comments
14 hours 6 min ago
1 day 13 hours ago
3 days 14 hours ago
4 days 4 hours ago
4 days 15 hours ago
4 days 20 hours ago
5 days 49 min ago
1 week 21 hours ago
1 week 1 day ago
1 week 4 days ago