Dear at the moment that I authenticate I generate this error, to which it is due thanks
Good morning, try porfa following the following steps:
It is a problem of the cache, and is that the forgery-token is saved information relative to the session that we have started with the server, including the logged-in user. Being a GET request, the browser tries to get that token from the cache, but the server realizes that this token has been loaded from the browser's cache and has not been generated in the current request, so, to avoid attacks Cross-Site Request Forgery, our server (which is very smart) says: eh !, where do you think you're going?
The solution for the browser not to load that token (and other things) in the GET requests that we do when we want to log in is to indicate it in our login method. In a default MVC4 project, that method is in the AccountController.cs class
[AllowAnonymous]
public ActionResult Login(string returnUrl)
{
ViewBag.ReturnUrl = returnUrl;
return View();
}
How do we tell it ?, by adding the OutputCache attribute as follows:
[AllowAnonymous]
[OutputCache(NoStore = true, Duration = 0)]
public ActionResult Login(string returnUrl)
{
ViewBag.ReturnUrl = returnUrl;
return View();
}
If we recompile and execute by repeating the logarnos process, navigate to the previous page with the browser button and clicking on Login, we no longer see the name of our previous user, but it appears empty and we can log in without any problem and without exceptions
I have attached the URL where I have read this solution, greetings.
I hope you find it useful, greetings.