2
I have the following code on the pages that, to be accessed, it is necessary to log in:
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 on the login screen:
@if (TempData["msg"] != null)
{
<div class="alert alert-danger">
@TempData["msg"]
</div>
}
However the message is not appearing, as if the TempData
is undoing itself. What do I have to do to get the message passed to the login screen?
For reference: https://answall.com/questions/149665/passagem-de-par%C3%A2metros-com-Asp-net-mvc/149674#149674
– Leonel Sanches da Silva