我最近询问了为什么一段代码在剃须刀语法方面不起作用,现在我又用相同的代码提出了新问题:
@if(Request.LogonUserIdentity.IsAuthenticated){
<ul id="menu">
<li>@Html.ActionLink("Location", "Index", "Location")</li>
<li>@Html.ActionLink("Service", "Index", "Service")</li>
<li>@Html.ActionLink("Service Assignment", "Index", "ServiceAssignment")</li>
<li>@Html.ActionLink("Content Management", "Index", "Content")</li>
</ul>
}else{
<ul id="menu">
<li>@Html.ActionLink("Location", "Index", "Location")</li>
<li>@Html.ActionLink("Map", "Map", "Home")</li>
<li>@Html.ActionLink("Help", "Help", "Home")</li>
</ul>
}
这次我的问题是:
为什么如果我登录或退出,我只能看到菜单,而你应该只看到你是否登录?
也就是说,无论我是否登录,我都会看到经过身份验证的用户菜单。我需要在控制器中更新什么吗?