剃刀 – 在身份3中创建声明身份
发布时间:2020-05-24 10:01:08 所属栏目:asp.Net 来源:互联网
导读:Visual Studio 2015脚手架使用UserManager TUser不能用于创建ClaimsIdentity.有没有人有一个如何做到这一点的工作示例? VS2015脚手架抛出错误: public async TaskClaimsIdentity GenerateUserIdentityAsync(UserManagerApplicationUser manager){
|
Visual Studio 2015脚手架使用UserManager< TUser>不能用于创建ClaimsIdentity.有没有人有一个如何做到这一点的工作示例? VS2015脚手架抛出错误: public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<ApplicationUser> manager)
{
// Note the authenticationType must match the one
// defined in CookieAuthenticationOptions.AuthenticationType
var userIdentity = await manager.CreateIdentityAsync(this,DefaultAuthenticationTypes.ApplicationCookie);
// Add custom user claims here
return userIdentity;
}
N.B.:我已经向ApplicationUser添加了与IdentyUser不冲突的属性. 解决方法UserManager在MVC6版本中已更改.您需要修改代码……public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<ApplicationUser> manager) {
var authenticationType = "Put authentication type Here";
var userIdentity = new ClaimsIdentity(await manager.GetClaimsAsync(this),authenticationType);
// Add custom user claims here
return userIdentity;
} (编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net – TextBox或Html区域中的换行符
- asp-classic – 经典的ASP页面是否会运行在Windows 7之后的
- asp.net-mvc-3 – 如何使用ASP.NET MVC 3“Razor”查看引擎
- asp.net – 对象“aspnet_CheckSchemaVersion”,数据库“XX
- 冻结asp.net网格视图列
- .net中基于资源的授权
- asp.net – jQuery AJAX vs. UpdatePanel
- asp.net-mvc – 什么是适当的时间为ViewData,ViewBag,会话,
- 收藏的asp.net文件上传类源码
- mvc6与signalr的任何样品?
推荐文章
站长推荐
- asp.net – IIS配置错误 – 此配置部分不能用于此
- asp.net – jQuery单击事件处理程序被调用两次复
- asp.net-mvc – 命中错误:在解析器和自定义注册
- asp.net – ASP .Net VNext和Owin
- asp.net-mvc – VS2012启用NuGet包恢复消失,缺少
- .net – 如何使用viewmodel绑定选择列表?
- ASP.Net Gridview,如何激活基于ID的编辑模式(Dat
- 表现 – 异步等待:他们不好吗?
- asp.net-mvc – Owin自主和ASP .Net MVC
- .net-4.0 – 从自定义IHttpHandler调用MvcHttpHa
热点阅读
