Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="utf-8"?>
- <configuration>
- <system.web>
- <authentication mode="Windows"></authentication>
- </system.web>
- </configuration>
- // Get the current Mode property.
- AuthenticationMode currentMode =
- authenticationSection.Mode;
- // Set the Mode property to Windows.
- authenticationSection.Mode =
- AuthenticationMode.Windows;
- var configuration = WebConfigurationManager.OpenWebConfiguration("/");
- var authenticationSection = (AuthenticationSection)configuration.GetSection("system.web/authentication");
- if (authenticationSection.Mode == AuthenticationMode.Forms)
- {
- //do something
- }
- protected void Page_Load(object sender, EventArgs e)
- {
- XmlDocument config = new XmlDocument();
- config.Load(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile);
- XmlNode node = config.SelectSingleNode("//configuration/system.web/authentication");
- this.Label1.Text = node.Attributes["mode"].Value;
- }
Add Comment
Please, Sign In to add comment