开发者

Pulling <identity> strings

开发者 https://www.devze.com 2023-02-06 04:09 出处:网络
In my Web.Config file, I have <identity userName=\"CTX_DOMAIN\\ldapuser\" password=\"ldapPW\" />

In my Web.Config file, I have

<identity userName="CTX_DOMAIN\ldapuser" password="ldapPW" />
开发者_如何学JAVA

How can I pull these userName and password strings in my C# behind code?


This should work:

    System.Web.Configuration.IdentitySection identityInfo = (System.Web.Configuration.IdentitySection)ConfigurationManager.GetSection("system.web/identity");
    string userName = identityInfo.UserName;
    string password = identityInfo.Password;
0

精彩评论

暂无评论...
验证码 换一张
取 消