0

I try to login users via ajax and I use in login form Html.AntiForgeryToken but I get error. because I after login users via ajax post another form that it has Html.AntiForgeryToken . I search and know that I should use Html.AntiForgeryToken with salt property but get me error.

How to fix this?

@Html.AntiForgeryToken(salt: "FormAjaxLogin")

enter image description here

hmahdavi
  • 2,250
  • 3
  • 38
  • 90
  • That method is deprecated. You should not need it. What is the issue with you current code? –  Jan 19 '17 at 06:09
  • I think because antiforgeriToken of page generated for unauthorized user and I try to post this after authorized user get me error. (The provided anti-forgery token was meant for a different claims-based user than the current user.Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Web.Mvc.HttpAntiForgeryException: The provided anti-forgery token was meant for a different claims-based user than the current user.) – hmahdavi Jan 19 '17 at 06:24
  • Have a look at a few of the initial hits when you [google that error](http://stackoverflow.com/questions/14970102/anti-forgery-token-is-meant-for-user-but-the-current-user-is-username) for possible solutions –  Jan 19 '17 at 06:29

0 Answers0