I got a partialView that I would only like to render if the user is logged in. Im thinking something like this:
View:
@Html.ActionLink("Text", "Method", "Controller")
<section id="events">
@Html.Partial("_CreateNewPost")
</section>
Controller:
[Authorize]
public ActionResult Method()
{
Code that renders the PartialView
return View();
}
This way, I would asume that a user that is not logged in will be sent to the login-page. Thanks!
Edit: So im wondering if its possible to create code in the method that renders the partial view. The way it is now, the partial view gets rendered as soon as the page loads.