问题描述
我想更新我的登录功能,使用这一行:
I am trying to update my login feature to using this line:
var result = await SignInManager.PasswordSignInAsync(model.Email, model.Password, model.RememberMe, shouldLockout: false);
不过,我得到以下错误:
However I get the following error:
Error 1 Using the generic type 'Microsoft.AspNet.Identity.Owin.SignInManager<TUser,TKey>' requires 2 type arguments
这我必须安装一些的NuGet软件包,我认为有些事情只是已经错过了某个地方,但是这是我的出路我联赛之前!任何帮助将是巨大的AP preciated,
Before this I had to install a few nuget packages so I think something merely has been missed somewhere, but this is way out my my league! Any help would be hugely appreciated,
感谢
推荐答案
您需要提供类型为好。像这样的:
You need to supply the types as well. Like this:
var result = await SignInManager.PasswordSignInAsync<IdentityUser, string>(model.Email, model.Password, model.RememberMe, shouldLockout: false);
IdentityUser
可 ApplicationUser
如果你去过下面的例子中code。
IdentityUser
may be ApplicationUser
if you've been following the example code.
另外,你看的例子都基于microsoft.aspnet.identity.samples的NuGet包。这将使一个 ApplicationSignInManager
在一个延伸的identityConfig.cs SignInManager&LT; ApplicationUser,串&GT;
,然后公开<$在的AccountController
C $ C> SignInManager 属性。它的这种特性的例子使用 - 因此,为什么它没有类型要求
Also, The examples you're looking at are based on the microsoft.aspnet.identity.samples nuget package. This would put an ApplicationSignInManager
in the identityConfig.cs which extends SignInManager<ApplicationUser, string>
and then a public SignInManager
property in the Accountcontroller
. Its this property that the examples use - hence why it doesn't have the type requirement.
这篇关于错误尝试更新的身份2.0中使用SignInManager的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!