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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • i_robot73@hotmail.com

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

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

    TextBox txtUserName = (TextBox)Login1 .FindControl("U serName");
    string requestor = WindowsIdentity .GetCurrent().N ame;
    string[] paramsLogin = requestor..Spli t('\\');
    txtUserName.Tex t = paramsLogin[1].ToString();

    I'm wondering if there's an easy way to read the
    'attributeMapUs ername' 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
  • Kuma

    #2
    Re: ASP login control pre-populate....bas ed on 'attributeMapUs ername'in web.config?

    On Nov 19, 9:18 pm, i_robo...@hotma il.com wrote:
    I've got a login control that pre-populates the username using:
    >
         TextBox txtUserName = (TextBox)Login1 .FindControl("U serName");
         string requestor = WindowsIdentity .GetCurrent().N ame;
         string[] paramsLogin = requestor..Spli t('\\');
         txtUserName.Tex t = paramsLogin[1].ToString();
    >
    I'm wondering if there's an easy way to read the
    'attributeMapUs ername' 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.LogonUs erIdentity.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.Configur ation.Congiurat ionManager.It is a static class with 2
    read only properties that are collections of connectionstrin gs and
    appsettings there are also other methods for retrieving just about any
    part of the web.config you want.

    Comment

    Working...