i'm creating an MVC3 C# application. i createtd a login attribute which only appears when a 开发者_开发问答user chooses to either create,delete,or edit data stored. To logout, i put the HTML code in th layout view, but its displaying on th homepage even if the user did not log in. how do i make it display on all pages after user has logged in, and when user logs out, it is no mor displayed?
Just check if the user is authenticated
@if (Request.IsAuthenticated) {
<div>control to logout</div>
}
精彩评论