如何更改Bootstrap登录注销在asp.net?

时间:2015-10-23 14:31:24

标签: c# asp.net twitter-bootstrap-3

我正在使用带有ASP.net主页的Bootstrap,因此导航栏在主页中如何在用户登录后更改登录图标以退出,反之亦然。 请提供一些例子

1 个答案:

答案 0 :(得分:0)

您可以向链接添加课程或图片:

@if (Request.IsAuthenticated)
{
     // ...here you have a link to logut - you can add class or image or whatever you need
     <a href="javascript:document.getElementById('logoutForm').submit()">Log off</a>
     // ...
} 
else 
{
     // ... here you have a link to log-in - you can add class or image or whatever you need
    <li>@Html.ActionLink("Log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" })</li>
     // ...
}