I'm trying to call a PartialView from within a page, the PartialView has IsAuthenticated
, but the User
is null, is there a way to populate this information (and be secure)?
My view is calling a Controller's ActionResult
like this:
@Ajax.ActionLink(
"Update Admin Menu",
"/Admin/Menu/GetMenu?MenuType=AdminMenu",
null,
null,
new AjaxOptions
{
HttpMethod = "GET",
InsertionMode = InsertionMode.Replace,
OnBegin = "",
OnComplete = "",
UpdateTargetId = "user-menu"
},
new { style = "btn btn-info" }
)
Then, the PartialView:
@if (User.Identity.IsAuthenticated)
{
//return details only if logged in.
}
System.NullReferenceException: 'Object reference not set to an instance of an object.'
I don't believe this is possible, but I thought I would ask this community. Thank you!