Guest User

Untitled

a guest
Jul 31st, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. OnAuthenticate Login Control
  2. protected void LoginUser_OnAuthenticate(object sender, AuthenticateEventArgs e)
  3. {
  4. TextBox UserName = LoginUser.FindControl("UserName") as TextBox;
  5. TextBox Password = LoginUser.FindControl("Password") as TextBox;
  6.  
  7. if (Membership.ValidateUser(UserName.Text, Password.Text))
  8. {
  9. FormsAuthentication.SetAuthCookie(UserName.Text, true);
  10.  
  11. ProfileCommon profile = Profile.GetProfile(UserName.Text);
  12. profile.Visits += 1;
  13. profile.Save();
  14.  
  15. e.Authenticated = true;
  16.  
  17. if (Request.QueryString["ReturnUrl"] != null)
  18. {
  19. Response.Redirect(Request.QueryString["ReturnUrl"]);
  20. }
  21. else
  22. {
  23. FormsAuthentication.RedirectFromLoginPage(UserName.Text, true);
  24. }
  25. }
  26.  
  27. }
Add Comment
Please, Sign In to add comment