ASP.NET MVC的默认项目模板附带了一个名为Microst.AspNet.Identity.Owin.SignInManager的类.此类用于验证用户身份
我不明白为什么我应该使用SignInManager而不是在ASP.NET MVC项目中使用简单的FormsAuthentication.SignInManager有什么好处?
它是否根据FormsAuthentication以不同的方式进行身份验证?它比FormsAuthentication更安全吗?除了身份验证之外,我还可以使用SignInManager做什么?
SignInManager和下面的代码之间有什么关系?SignInManager是否使用下面设置的设置?
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Account/Login"),
Provider = new CookieAuthenticationProvider
{
// Enables the application to validate the security stamp when the user logs in.
// This is a security feature which is used when you change a password or add an external login to your account.
OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, ApplicationUser>(
validateInterval: TimeSpan.FromMinutes(30),
regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager))
}
});
Run Code Online (Sandbox Code Playgroud) 我正在Web.Config中修改一个用C#编写的ASP.NET应用程序的会话时间,目前我将超时设置为120分钟,如下所示:
<sessionState mode="InProc" cookieName="Application_SessionId" timeout="120"/>
Run Code Online (Sandbox Code Playgroud)
这个值有限制吗?因此,如果我希望将其设置为24小时(1440分钟),那么这将适用吗?
它是带有MVC 2.0的ASP.NET 4.0版