开发者

MVC3 where to pu the logout display

开发者 https://www.devze.com 2023-04-09 04:58 出处:网络
i\'m creating an MVC3 C# application. i createtd a login attribute which only appears whena 开发者_开发问答user chooses to either create,delete,or edit data stored. To logout, i put the HTML code in t

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>
}
0

精彩评论

暂无评论...
验证码 换一张
取 消