Page view counter

Active Directory Login Username Format

Last post 11-28-2005 9:50 AM by schuchert. 3 replies.

Sort Posts:

  • Active Directory Login Username Format

    11-22-2005, 8:45 AM
    • Loading...
    • schuchert
    • Joined on 10-21-2005, 3:33 PM
    • Posts 6
    • Points 30
    Is it possible to set the module to look for just the username portion of the login and not the domain\username format?   Can i hardcode the "domain\" somewhere? If so, where?
  • Re: Active Directory Login Username Format

    11-22-2005, 2:16 PM
    • Loading...
    • simonduz1
    • Joined on 08-11-2003, 9:47 PM
    • Posts 432
    • Points 2,160
  • Re: Active Directory Login Username Format

    11-22-2005, 2:46 PM
    • Loading...
    • SnoMan
    • Joined on 09-13-2005, 12:08 AM
    • Halifax, Nova Scotia
    • Posts 4
    • Points 20
     schuchert wrote:
    Is it possible to set the module to look for just the username portion of the login and not the domain\username format?   Can i hardcode the "domain\" somewhere? If so, where?


    Back in the second thread for Tam's module (http://forums.asp.net/1065878/ShowPost.aspx), Caelen98 was able to "hardcode" by using the following;


    >>Back to the hidden domain question, is there a way to capture the username from Tam's Authentication Login Page, set a variable up, and tack the domain\+username together and pass that on during the submission?<<

    This is how I did it....  In the AuthenticationSignin.ascx, I put the following at the top of the code:

    <script runat="server">

    Sub change(sender As Object, e As EventArgs)

    txtUsername.Text="oldplacerville\" & txtUsername.Text

    End Sub

    </script>

    Then, I updated the following line:

    <td colspan="2" align="center"><asp:textbox id="txtUsername" ontextchanged="change" columns="9" width="130" cssclass="NormalTextBox" runat="server" /></td>

    (adding ontextchanged="change") which calls the top script.

    This has worked well for me.


    The one thing you need to watchout  for doing these changes is that when you go to login to the site, the changes will append the "domain name\" at the front.  Host and Admin included!!!  The way I got around that was to update Caelen98's first change by adding an ElseIf statement.

    <script runat="server">
     
    Sub change(sender As Object, e As EventArgs)

    if txtUsername.Text="admin" then
     txtUsername.Text="admin"

    elseif txtUsername.Text="host" then
     txtUsername.Text="host"

    else txtUsername.Text="yourdomain\" & txtUsername.Text

    end if

    end sub
     
    </script>

    This was able to let me preserve the Host and Admin account.  I just tried these changes with 3.2 and things worked like a charm.  The file to modify is \admin\Security\Signin.ascx  Just don't forget the ElseIf statements so you can still get in with the Admin and Host accounts.

    Hope this helps

  • Re: Active Directory Login Username Format

    11-28-2005, 9:50 AM
    • Loading...
    • schuchert
    • Joined on 10-21-2005, 3:33 PM
    • Posts 6
    • Points 30
    Works like a charm, thanks!
Page 1 of 1 (4 items)