Guest User

Untitled

a guest
Aug 8th, 2018
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. Ajax Authentication without DoS attack possible
  2. public bool ValidateUser(string username, string password,bool rememberMe)
  3. {
  4. if(Membership.ValidateUser(username, password))
  5. {
  6. FormsAuthentication.SetAuthCookie(username, rememberMe);
  7. return true;
  8. }
  9. return false;
  10. }
  11.  
  12. function validateUser() {
  13.  
  14. var username = $('#<%=UserName.ClientID %>').val();
  15. var pass =$('#<%=Password.ClientID %>').val();
  16. $.ajax({
  17. type: "POST",
  18. url: "Services/LoginService.asmx/ValidateUser",
  19. data: "{'username ':'" + username + "','password':'" + pass + "','rememberMe':'" + $('#<%=chbRememberMe.ClientID %>').attr('checked') + "'}",
  20. contentType: "application/json; charset=utf-8",
  21. dataType: "json",
  22. success: function(data, status) { OnSuccessLogin(data, status); },
  23. error: OnErrorLogin
  24. });
  25. }
Add Comment
Please, Sign In to add comment