Answer the question
In order to leave comments, you need to log in
Why is controller method execution skipped in ASP.NET Core?
There is a master page with the following section responsible for the user's card (the ability to log in or go to the profile / log out of the account)
<div class="header_form">
<a class="logo_hiden" href="/">
<img src="~/img/logo.svg" alt="TRUprogram">
</a>
@if (Context.Session.Keys.Contains("user"))
{
<div class="lk_mini">
<div class="user">
<a class="n" href="~/User/Profile">
@Context.Session.GetString("user")
</a>
<a class="v" href="~/User/Logout">Выйти</a>
</div>
<a href="~/User/Profile">
<img width="50px" src="@Context.Session.GetString("userAvatar")" alt="avatar">
</a>
</div>
}
else
{
<a href="~/User/Login"><input class="log_btn" type="button" value="Вход"></a>
}
</div>
public IActionResult Logout()
{
if (!HttpContext.Session.Keys.Contains("user"))
return LocalRedirectPermanent("/");
foreach (var key in HttpContext.Session.Keys)
{
HttpContext.Session.Remove(key);
}
Response.Cookies.Delete(".AspNetCore.Session");
return LocalRedirectPermanent("/");
}
Answer the question
In order to leave comments, you need to log in
The browser cached the 301 code and did not send the request.
Try clearing/clearing the cache or logging in incognito.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question