|
So at the top of my controllers i've added in [Authorize], So far so good only logged in users can access these pages (Person and Holiday)
However the tabs in the homeController which navigate the users to these pages are still displayed...coming from the layout.cs
<li>@Html.ActionLink("Home", "Index", "Home")</li>
<li>@Html.ActionLink("About", "About", "Home")</li>
<li>@Html.ActionLink("Person", "Index", "Person")</li>
<li>@Html.ActionLink("Holidays", "Index", "Holidays")</li>
How can I only get these tabs to display if a user is logged in.
I have tried the approach of adding in a bool in the AccountController.cs
else
{
loggedIn = true;
return RedirectToAction("Index", "Home");
}
}
else
{
loggedIn = false;
ModelState.AddModelError("", "The user name or password provided is incorrect.");
}
but then how do I access this from the layout.cs?
Is this the correct approach. Please advise. thanks
|
|
|
|
|
Don't you think this would be more appropriate in the ASP.NET forum?
|
|
|
|