Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Ajax Authentication without DoS attack possible
- public bool ValidateUser(string username, string password,bool rememberMe)
- {
- if(Membership.ValidateUser(username, password))
- {
- FormsAuthentication.SetAuthCookie(username, rememberMe);
- return true;
- }
- return false;
- }
- function validateUser() {
- var username = $('#<%=UserName.ClientID %>').val();
- var pass =$('#<%=Password.ClientID %>').val();
- $.ajax({
- type: "POST",
- url: "Services/LoginService.asmx/ValidateUser",
- data: "{'username ':'" + username + "','password':'" + pass + "','rememberMe':'" + $('#<%=chbRememberMe.ClientID %>').attr('checked') + "'}",
- contentType: "application/json; charset=utf-8",
- dataType: "json",
- success: function(data, status) { OnSuccessLogin(data, status); },
- error: OnErrorLogin
- });
- }
Add Comment
Please, Sign In to add comment