When the cookie expires, it renders a view within my form when making a post. Why is this happening?

0

I have the following problem, which is not why it happens or how to fix it. Next I expose the case.

I have a web application built with asp.net mvc5 which has a cookie that lasts x minutes, at the time of expiration and is about to submit some of the forms, this brings me the view of my login to my form instead of redirecting me to my login page.

I was checking my drivers, but I do not have any condition on any that says "bring me to login" in fact I'm just returning JSON in my returns.

In my Webconfig I have the following authentication handler

<authentication mode="Forms">
  <forms loginUrl="~/users/iniciar-sesion" timeout="2" slidingExpiration="false" />
</authentication>

My controller GET:

[HttpGet]
[Route("miruta/mirutaconnombre")]
public ActionResult MiController() => View();

My POST controller:

[HttpPost]
[ValidateAntiForgeryToken]
[Route("miruta/mirutaconnombre")]
public async Task<ActionResult> MiController(CreditViewModel model)
{
    if (!ModelState.IsValid)
        return View(model);

    // Validaciones internas
    // ...

    return Json(model);
}

As you can see I only return a Json, this had never happened to me, I do not know what it can be, is there someone who can guide me with this?

    
asked by vcasas 31.05.2018 в 22:59
source

0 answers