Detecting Web.Config Authentication Mode

前端 未结 5 1315
故里飘歌
故里飘歌 2021-02-13 09:15

Say I have the following web.config:



    
        

        
5条回答
  •  长情又很酷
    2021-02-13 10:10

    use an xpath query //configuration/system.web/authentication[mode] ?

    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;
    }
    

提交回复
热议问题