ASP.NETMVCView页面内判断是否登录
2015-08-11 20:12
696 查看
ASP.NETMVCView页面内判断是否登录
直接写这个判断即可
直接写这个判断即可
@if (Request.IsAuthenticated) { <text> 你好,@Html.ActionLink(User.Identity.Name, "Manage", "Account", routeValues: null, htmlAttributes: new { @class = "username", title = "管理" })! @using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm" })) { @Html.AntiForgeryToken() <a href="javascript:document.getElementById('logoutForm').submit()">注销</a> } </text> } else { <ul> <li>@Html.ActionLink("注册", "Register", "Account", routeValues: null, htmlAttributes: new { id = "registerLink" })</li> <li>@Html.ActionLink("登录", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" })</li> </ul> }
相关文章推荐
- ASP.NET_MVC4_使用ViewModel给前台传递多个model
- 如何制作一个ASP.NETMVC4信息发布网站
- ASP.NET 页面禁止被 iframe 框架引用
- VS EF Error: Configuration Error extension=".edmx" type="System.Data.Entity.Design.AspNet.EntityDesignerBuildProvider"
- android--asp.net webservice 返回json
- ASP如何计算中英文混合字符串长度和截取字符串 .
- 用Metasploit破解Mysql用户名和密码
- asp.net 父窗体获取子窗体的返回值,可用来对父窗体局部更新
- ASP.NET验证码(3种)
- ASP.NET WebForm
- Asp.Mvc 2.0实现用户注册实例讲解(1)
- ASP.NET MVC4之js css文件合并功能(3)
- ASP.NET MVC3模板页的使用(2)
- 检测到有潜在危险的 Request.Form 值。 说明: ASP.NET 在请求中检测到包含潜在危险的数据
- 简析ASP.NET网站的创建与发布过程
- 七天学会ASP.NET MVC(七)――创建单页应用
- 七天学会ASP.NET MVC(七)——创建单页应用
- 七天学会ASP.NET MVC(七)——创建单页应用
- ASP.NET Web Api 实践系列(二)Get/Post方式调用Web Api
- asp.net(c#)有关 Session 操作的几个误区