Advertise with us

Pulling <identity> strings

Posted by  Ankit Singh
 1509  View(s)
Ratings:
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; 


Answer