Sashidhar Kokku's blog

Controlling your username while binding to ActiveDirectoryMembershipProvider [ASP.NET 2.0]

When using ActiveDirectoryMembershipProvider, default login options mandate your username to be [username]@[domainName].[extn].

However, should you want to use just the username, and nothing else, then the simplest option would be to add the attributeMapUsername attribute in the configuration file (membership section).

 Example :

<membership defaultProvider="ADProvider">
 <providers>
  <clear/>
  <add name="ADProvider"  type="System.Web.Security.ActiveDirectoryMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral,   PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="ADConnectionString" attributeMapUsername="sAMAccountName" />
 </providers>
</membership>

 

Options for attributeMapUsername are :

  • userPrincipalName [default option]
  • sAMAccountName

Comments

zxevil163 said:

b0r750 Hi from Russia!

# March 16, 2008 5:15 PM

Apply food stamp said:

I wanted to research this subject and write a paper. Your post what a thousand words would not. Nice job.

______________________________________________________________________________________

http://applyfoodstamp.com

# September 22, 2008 11:15 AM
Leave a Comment

(required) 

(required) 

(optional)

(required)