我有一个ASP.NET Core 1.1应用程序,其中包含使用此API的代码:
Microsoft.AspNetCore.Identity.IdentityCookieOptions
Run Code Online (Sandbox Code Playgroud)
当我尝试升级到ASP.NET Core 2.0时,编译器给出了这个错误:
错误CS0246:找不到类型或命名空间名称'IdentityCookieOptions'(您是否缺少using指令或程序集引用?)
ASP.NET Core 2.0中的等效API是什么?
nat*_*ter 12
此更改中删除了此API:https://github.com/aspnet/Identity/pull/1188
在大多数情况下,您最有可能使用默认值.您可以替换IdentityCookieOptions使用IdentityConstants.如果您已自定义此值,则可能需要找到另一种方法将自定义方案名称传递到相应的SignInManager调用(以及使用其他任何其他auth方案).
例子:
// old
IdentityCookieOptions.ApplicationScheme
IdentityCookieOptions.ApplicationCookieAuthenticationScheme
// new
IdentityConstants.ApplicationScheme
// old
IdentityCookieOptions.ExternalScheme
IdentityCookieOptions.ExternalCookieAuthenticationScheme
//new
IdentityConstants.ExternalScheme
//old
IdentityCookieOptions.TwoFactorRememberMeScheme
IdentityCookieOptions.TwoFactorRememberMeCookieAuthenticationScheme
//new
IdentityConstants.TwoFactorRememberMeScheme
//old
IdentityCookieOptions.TwoFactorUserIdScheme
IdentityCookieOptions.TwoFactorUserIdCookieAuthenticationScheme
//new
IdentityConstants.TwoFactorUserIdScheme
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2305 次 |
| 最近记录: |