Click here to Skip to main content
15,886,019 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All, I got a Login page, using the .net login control that work correctly on my intranet network.
XML
<asp:Login ID="LoginUser" runat="server" EnableViewState="false"
       RenderOuterTable="false" DisplayRememberMe="False">
       <LayoutTemplate>
           <table cellpadding="1" cellspacing="0" style="border-collapse:collapse;">
               <tr>
                   <td>
                       <table cellpadding="0">
                           <tr>
                               <td align="center" colspan="2">
                                   Log In</td>
                           </tr>
                           <tr>
                               <td align="right">
                                   <asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName">User Name:</asp:Label>
                               </td>
                               <td>
                                   <asp:TextBox ID="UserName" runat="server"></asp:TextBox>
                                   <asp:RequiredFieldValidator ID="UserNameRequired" runat="server"
                                       ControlToValidate="UserName" ErrorMessage="User Name is required."
                                       ToolTip="User Name is required." ValidationGroup="LoginUser">*</asp:RequiredFieldValidator>
                               </td>
                           </tr>
                           <tr>
                               <td align="right">
                                   <asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password">Password:</asp:Label>
                               </td>
                               <td>
                                   <asp:TextBox ID="Password" runat="server" TextMode="Password"></asp:TextBox>
                                   <asp:RequiredFieldValidator ID="PasswordRequired" runat="server"
                                       ControlToValidate="Password" ErrorMessage="Password is required."
                                       ToolTip="Password is required." ValidationGroup="LoginUser">*</asp:RequiredFieldValidator>
                               </td>
                           </tr>
                                                       <tr>
                               <td align="right">
                                   <asp:Label ID="DomainLabel" runat="server" AssociatedControlID="Domain">Domain:</asp:Label>
                               </td>
                               <td>
                                   <asp:TextBox ID="Domain" runat="server"></asp:TextBox>
                                   <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
                                       ControlToValidate="Domain" ErrorMessage="Domain is required."
                                       ToolTip="Domain is required." ValidationGroup="LoginUser">*</asp:RequiredFieldValidator>
                               </td>
                           </tr>
                           <tr>
                               <td align="center" colspan="2" style="color:Red;">
                                   <asp:Literal ID="FailureText" runat="server" EnableViewState="False"></asp:Literal>
                               </td>
                           </tr>
                           <tr>
                               <td align="right" colspan="2">
                                   <asp:Button ID="LoginButton" runat="server" CommandName="Login" Text="Log In"
                                       ValidationGroup="LoginUser" />
                               </td>
                           </tr>
                       </table>
                   </td>
               </tr>
           </table>
       </LayoutTemplate>
   </asp:Login>




since we have different domains in our network, how can use the domain field to login user on specific domain?
Thanks in advance...
if someone can redirect me to an example...I'm gonna to be crazy for this little problem!! X|
Posted

1 solution

Do you want to pre-fill your domain field with all available domains? This will require walking the trust chain in AD, starting from the domain in which the server is a member. This may be complicated. You could also query the dns chain for _mscds records, but this sounds iffy, and if it works, may return false positives (domains that have no trust, and are not in the forest). If you still have netbios names, querying the wins server for PDC's might also work, but of course this is not really a forward-looking solution.
If pre-filling is not necessary, just ask the user for the domain name, append a backslash and the username, and let the OS do it's thing.
Users may also login by giving their userid@domain.whatever, and the Operating System will find it's children.
Does this answer your question, or have I misunderstood something?
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900