ASP.NET Membership - Add extra field to ASP.Net Login page -


currently in application, validating users using asp.net membership provider , asp.net default login page contains username , password. working fine 2 fields. per current requirement, need field "company" display dropdownlist in asp.net login page , validate 3 company, username , password using asp.net membership provider. possible or not, customize asp.net login page field using asp.net membership provider? please give me ideas how approach?

membership provider's validateuser method accept 2 parameters - username , password. if override it, cannot pass 3 parameters.

validateuser(string username, string password) 

basically, cannot use login control validate user. instead, want validate user yourself. here sample code -

enter image description here

note: strip out codes in login control demo purpose.

<asp:login id="loginuser" runat="server" onauthenticate="loginuser_authenticate">     <layouttemplate>         <asp:textbox id="username" runat="server" />         <asp:textbox id="password" runat="server" textmode="password" />         <asp:dropdownlist id="companydropdownlist" runat="server">             <asp:listitem text="one" value="1" />             <asp:listitem text="two" value="2" />         </asp:dropdownlist>         <asp:button id="loginbutton" runat="server" commandname="login"          text="log in" validationgroup="loginuservalidationgroup" />     </layouttemplate> </asp:login>  protected void loginuser_authenticate(object sender, authenticateeventargs e) {     var companyname = loginuser.findcontrol("companydropdownlist")          dropdownlist;      if(myvalidateuser(loginuser.username, loginuser.password,          companyname.selectedvalue))     {         formsauthentication.setauthcookie(loginuser.username, false);          //     } } 

please make sure use new asp.net universal providers


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -