Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- OnAuthenticate Login Control
- protected void LoginUser_OnAuthenticate(object sender, AuthenticateEventArgs e)
- {
- TextBox UserName = LoginUser.FindControl("UserName") as TextBox;
- TextBox Password = LoginUser.FindControl("Password") as TextBox;
- if (Membership.ValidateUser(UserName.Text, Password.Text))
- {
- FormsAuthentication.SetAuthCookie(UserName.Text, true);
- ProfileCommon profile = Profile.GetProfile(UserName.Text);
- profile.Visits += 1;
- profile.Save();
- e.Authenticated = true;
- if (Request.QueryString["ReturnUrl"] != null)
- {
- Response.Redirect(Request.QueryString["ReturnUrl"]);
- }
- else
- {
- FormsAuthentication.RedirectFromLoginPage(UserName.Text, true);
- }
- }
- }
Add Comment
Please, Sign In to add comment