Pulling <identity> strings

Total Post:341


 1439  View(s)
Rate this:

In my Web.Config file, I have

<identity userName="CTX_DOMAIN\ldapuser" password="ldapPW" />

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

  1. Re: Pulling <identity> strings

    Hi Ankit,

    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; 


Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.