Get Authentication Mode from Web.Config file
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
11 hours 51 min ago
17 hours 26 min ago
1 week 1 day ago
1 week 1 day ago
1 week 1 day ago
1 week 4 days ago
2 weeks 13 hours ago
2 weeks 14 hours ago
2 weeks 14 hours ago
2 weeks 17 hours ago