PDA

View Full Version : Override the asp:ChangePassword for custom use? [ASP.NET 2.0]


Shaitan00
08-10-2008, 08:14 AM
I'm using the <asp:login> control to perform user authentication on my web page, however I am not using the ASP membership stuff, instead I opted to customize the login behavior seeing as I use a Database for authentication purposes


[Default.aspx]
<asp:login id="Login1" OnAuthenticate="OnAuthenticate" runat="server">
...
</asp:login>


[Default.aspx.cs]
// Login Authentication Event //
protected void OnAuthenticate(object sender, AuthenticateEventArgs e)
{
bool Authenticated = false;
Authenticated = AuthenticationMethod(Login1.UserName, Login1.Password);

e.Authenticated = Authenticated;
}

Where "AuthenticationMethod" is my custom authentication function that accesses my database and checks to ensure the username/password is valid.


Now I wanted to implement handling to allow the user to change his password, so similarily I decided to use the <asp:ChangePassword> control, however I can't see to find out how to overide the basic functionality which uses ASP membership and instead allow myself to perform the changes to my database instead.
Essentially - I just wanted to use the GUI (html layout) and some of the password validation functionality within <asp:ChangePassword> control so not to have to do it all manually ...

Is there anyway to do this? Or am I going about this the wrong way?
Thanks,

Brandoe85
08-11-2008, 05:05 PM
If you look here; there is an example (very last one on page) of how to find controls within the control. You could then override the button event.

http://quickstarts.asp.net/QuickStartv20/aspnet/doc/ctrlref/login/changepassword.aspx

Good luck;