---
title: "Pulling <identity> strings"  
description: "Pulling <identity> strings"  
author: "Anonymous User"  
published: 2014-08-23  
updated: 2014-08-23  
canonical: https://www.mindstick.com/forum/2098/pulling-identity-strings  
category: "asp.net"  
tags: ["asp.net"]  
reading_time: 1 minute  

---

# Pulling <identity> strings

In my [Web.Config](https://www.mindstick.com/forum/183/web-config-file) [file](https://www.mindstick.com/articles/59/encrypting-and-decrypting-files-using-c-sharp), I have

<[identity](https://www.mindstick.com/articles/13090/icon-the-identity-of-your-brand) userName="CTX_DOMAIN\ldapuser" password="ldapPW" />

How can I pull these [userName and password](https://www.mindstick.com/forum/160407/how-does-a-bearer-token-differ-from-other-authentication-methods-such-as-username-and-password) [strings](https://www.mindstick.com/forum/161912/explain-the-python-strings) in my C# behind [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii)?

## Replies

### Reply by Sumit Kesarwani

Hi Ankit,\

This should work:

System.Web.Configuration.IdentitySection identityInfo = (System.Web.Configuration.IdentitySection)ConfigurationManager.GetSection("system.web/identity");

string [userName](https://www.mindstick.com/forum/12798/there-is-no-viewdata-item-of-type-ienumerable-selectlistitem-that-has-the-key-username) = identityInfo.UserName;

string [password](https://www.mindstick.com/blog/118/retriving-user-password-by-using-stored-procedure-in-asp-dot-net) = identityInfo.Password; \
\


---

Original Source: https://www.mindstick.com/forum/2098/pulling-identity-strings

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
