I have a identity validation problem I have a HTML and CSS I like to display for people logged in with a ticket number but whenever I start the application after I've closed it as a user logged in I always return as a logged in user with invalid ticket number.
<ul class="navbar-nav justify-content-end">
@if (HttpContext.Current.User.Identity.IsAuthenticated)
{
<li class="nav-item pt-4">
<a class="nav-link" aria-current="page" href="/mina-sidor/">Mina sidor</a>
</li>
<li class="nav-item pt-4">
@Html.ActionLink("Logga ut", "Logout", "Authentication", new { area = "" }, new { @class = "btn btn-primary" })
</li>
<li class="nav-item pt-4 px-1">
<p>Inloggad som <br /> <strong>@User.Identity.Name</strong></p>
</li>
}
else
{
<li class="nav-item pt-2">
@Html.ActionLink("Logga in", "Login", "Authentication", new { area = "" }, new { @class = "btn btn-primary" })
</li>
}
</ul>
HttpContext.Current.User.Identity.IsAuthenticated -> returns true always unless I manually log out.
I've tried Request.IsAuthenticated -> same here.
How do I handle that this return false when the website is closed or it has timed-out?