ASP.NET标识会话超时
发布时间:2020-12-15 23:55:54 所属栏目:asp.Net 来源:网络整理
导读:我使用ASP.NET身份..我想将会话超时设置为无限或最大值.我尝试了一些东西,但它没有效果.注意:我使用共享主机. 谢谢. //web.configsystem.webcustomErrors mode="Off" /httpRuntime targetFramework="4.5" /authentication mode="Forms" /sessionState timeo
我使用ASP.NET身份..我想将会话超时设置为无限或最大值.我尝试了一些东西,但它没有效果.注意:我使用共享主机.
谢谢. //web.config <system.web> <customErrors mode="Off" /> <httpRuntime targetFramework="4.5" /> <authentication mode="Forms" /> <sessionState timeout="500000" /> </system.web> //asp.identiyt config public void ConfigureAuth(IAppBuilder app) { app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,ExpireTimeSpan = TimeSpan.FromDays(365),LoginPath = new PathString("/user/login"),Provider = new CookieAuthenticationProvider { OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager,ApplicationUser,int> ( validateInterval: TimeSpan.FromDays(365),regenerateIdentityCallback: (manager,user) => user.GenerateUserIdentityAsync(manager),getUserIdCallback: (id) => (Int32.Parse(id.GetUserId())) ) } }); } 解决方法public void ConfigureAuth(IAppBuilder app) { var sessionTimeout = 20; // app.UseCookieAuthentication(new CookieAuthenticationOptions { ExpireTimeSpan = TimeSpan.FromSeconds(30),}); } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- 从2.0到3.5的ASP.NET框架效应?
- 在ASP.NET 3.5中实现异常处理
- asp.net-core – 在JsonPatchDocument中使用.Net Core Web
- asp.net – 使用DataPager而不检索每个请求的所有行
- asp.net-mvc – formcollection只保存所选的html.listbox项
- asp.net-mvc – HandleErrorAttribute无法正常工作
- ASP.NET MVC4代码优先 – ‘无法附加文件作为数据库’异常
- ASP.NET MVC 3 Razor:如何在JavaScript字符串变量中获取Ac
- asp.net-mvc – ASP.NET Webforms或ASP.NET MVC中的电子商务
- asp.net – Azure网站上脚本/样式的长时间等待(TTFB)时间
推荐文章
站长推荐
- asp.net-mvc – Sammy.js和Knockout.js =>模板没
- asp.net-mvc – warns – html.helpers在项目更新
- .net – 如何将多个数据视图合并为一个?
- 使用asp.net 4.5 OAuth注册google与clientid和se
- asp.net – 如何在.net vb中发送POST?
- asp.net-core – 如何在Entity Framework Core中
- asp.net – aspnet_compiler找到错误版本的Syste
- IIS如何处理ASP.net MVC请求?
- asp.net-mvc – 如何在网站上重新创建电子表格或
- 使用ASP.NET MVC3中的jQuery,可点击日期的事件日
热点阅读