加入收藏 | 设为首页 | 会员中心 | 我要投稿 鄂州站长网 (https://www.0711zz.com.cn/)- 云通信、区块链、物联平台、操作系统、高性能计算!
当前位置: 首页 > 站长学院 > Asp教程 > 正文

基于.NET Core 3.1 网站开发和部署的方法

发布时间:2020-09-18 06:03:23 所属栏目:Asp教程 来源:网络整理
导读:这篇文章主要介绍了基于.NET Core 3.1 网站开发和部署的方法,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面

List<Claim> claims = new List<Claim>() { new Claim("username", admin.LoginName) }; ClaimsIdentity claimsIdentity = new ClaimsIdentity(claims, CookieAuthenticationDefaults.AuthenticationScheme); AuthenticationProperties properties = new AuthenticationProperties() { IsPersistent = true }; await HttpContext.SignInAsync ( CookieAuthenticationDefaults.AuthenticationScheme, new ClaimsPrincipal(claimsIdentity), properties );

其他需登录后才能访问的资源,在控制器上添加 [Authorize]标记

(编辑:鄂州站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

热点阅读