Reputation: 21430
I am trying to get my login partial to read the user's first and last name from my database. Therefore, I am trying to call an action from my layout instead of the view partial.
@If Request.IsAuthenticated Then
@<text><div class="authBox">Welcome <strong>@User.Identity.Name</strong>!
</div></text>
Else
I am getting a stack overflow exception on this line in my layout:
@Html.Action("RenderLogOnPartial", "Employee")
Here is the action I am calling:
'
' GET: /Employee/RenderLogOnPartial
Public Function RenderLogOnPartial() As ViewResult
Return View("_LogOnWithValidationPartial")
End Function
What can I do to get the first and last name into my view partial? Thanks.
Upvotes: 1
Views: 1241
Reputation: 107277
Views will use your layout, which will call your action again, hence the stackoverflow.
Try
Return PartialView("_LogOnWithValidationPartial")
Upvotes: 2