By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,084 Members | 1,969 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,084 IT Pros & Developers. It's quick & easy.

ASP login control pre-populate....based on 'attributeMapUsername' inweb.config?

P: n/a
I've got a login control that pre-populates the username using:

TextBox txtUserName = (TextBox)Login1.FindControl("UserName");
string requestor = WindowsIdentity.GetCurrent().Name;
string[] paramsLogin = requestor..Split('\\');
txtUserName.Text = paramsLogin[1].ToString();

I'm wondering if there's an easy way to read the
'attributeMapUsername' setting (if there is one) from the web.config.

IF is set to 'sAMAccountName', remove the domain info.

Trying to make this as idiot proof as possible, since it seems no one
READS the d@mn instructions printed on the screen =P
Nov 19 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On Nov 19, 9:18*pm, i_robo...@hotmail.com wrote:
I've got a login control that pre-populates the username using:

* * *TextBox txtUserName = (TextBox)Login1.FindControl("UserName");
* * *string requestor = WindowsIdentity.GetCurrent().Name;
* * *string[] paramsLogin = requestor..Split('\\');
* * *txtUserName.Text = paramsLogin[1].ToString();

I'm wondering if there's an easy way to read the
'attributeMapUsername' setting (if there is one) from the web.config.

IF is set to 'sAMAccountName', remove the domain info.

Trying to make this as idiot proof as possible, since it seems no one
READS the d@mn instructions printed on the screen =P
In my web forms (Intranet only) I typically use the
Request.LogonUserIdentity.Name property. It is always in the Domain
\User format. It also contains a couple of other properties such as
IsAuthenticated IsAnonymous as well as properties containing pointers
to their Token etc.
If you are looking for an easy way to read from the web.config look at
System.Configuration.CongiurationManager.It is a static class with 2
read only properties that are collections of connectionstrings and
appsettings there are also other methods for retrieving just about any
part of the web.config you want.
Nov 21 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.