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.