PULLING <IDENTITY> STRINGS

Ankit Singh

Total Post:341

Points:2389
Posted by  Ankit Singh
 1087  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. Sumit Kesarwani

    Post:378

    Points:2694
    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

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!