您的位置:首页 > 编程语言 > ASP

ASP.NET MVC使用AuthenticationAttribute验证登录

2017-08-07 22:00 609 查看
首先,添加一个类AuthenticationAttribute,该类继承AuthorizeAttribute,如下:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Zhong.Web
{
public class TestAttribute : FilterAttribute, IAuthorizationFilter
{
public void OnAuthorization(AuthorizationContext filterContext)
{
//throw new NotImplementedException();
//TODO: 此处写需要实现登录验证的代码

}
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐