首页 > 编程语言 >asp.net 启用认证的全过程

asp.net 启用认证的全过程

时间:2023-02-25 21:46:58浏览次数:37  
标签:asp 启用 认证 FormsAuthentication 全过程 net

1、webconfig

<system.web>
<authentication mode="Forms">
<forms loginUrl="~/Admin/Login" timeout="2880"></forms>
</authentication>
</system.web>

增加下面的节点

2、认证

 FormsAuthentication.SetAuthCookie(UserName, false);

3、获取当前认证的信息

string userName = System.Web.HttpContext.Current.User.Identity.Name;

 

4、登出

FormsAuthentication.SignOut();

 

标签:asp,启用,认证,FormsAuthentication,全过程,net
From: https://www.cnblogs.com/sexintercourse/p/17155478.html

相关文章