我想在我的应用程序的所有页面上显示已登录用户的图像。我已成功地为用户详细信息创建了CRUD,但还想在所有页面上显示名称和其图片。我只能检索到名称。
我该如何检索图像呢?
_LoginPartial.cshtml:
我该如何检索图像呢?
_LoginPartial.cshtml:
@if (Request.IsAuthenticated)
{
Convert.ToString(ViewBag.EmployeeName);
<text> Hello, @Html.ActionLink(User.Identity.Name, "Manage", "Account",routeValues: null, htmlAttributes: new { @class = "username", title = "Manage" })
@using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm" }))
{
@Html.AntiForgeryToken()
<a href="javascript:document.getElementById('logoutForm').submit()">Log off</a>
}
</text>
}
else
{
<ul>
<li>@Html.ActionLink("Log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" })
</li>
</ul>
}
注意:
我正在使用asp.net MVC 4(Entity Framework)。