I have the following code in the pages that, to be accessed, you need to login:
if (Session["Login"] == null)
{
TempData["msg"] = "É necessário realizar o login para acessar esta página!";
Response.Redirect("/Login/Index");
}
This TempData["msg"]
is as follows in the login screen:
@if (TempData["msg"] != null)
{
<div class="alert alert-danger">
@TempData["msg"]
</div>
}
However, the message is not appearing, as if TempData
was canceling. What do I have to do to get the message to the login screen?