我希望会话活着吗? [英] I want session alive?

查看:55
本文介绍了我希望会话活着吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了一个网站,因为某些表单会变得非常大,以便填写表单会被删除,以便填写的表单将会丢失,如何避免这种情况请帮助我?





提前致谢。



我的尝试:



web.config

< authentication mode =Forms>

< forms name =MyAuthtimeout =120protection =AllloginUrl =〜/ Login.aspxslidingExpiration =true/>





< sessionstate mode =InProccookieless =falsetimeout =100>



page_load()

{

Response.AddHeader(Refresh,Convert.ToString((Session.Timeout * 60) - 60));

}

i have creating a website into that some forms are to much large so that filling that forms session will be expird so that filled form will be lost how can avoid this please help me?


Thanks in advance.

What I have tried:

web.config
<authentication mode="Forms">
<forms name="MyAuth" timeout="120" protection="All" loginUrl="~/Login.aspx" slidingExpiration="true" />


<sessionstate mode="InProc" cookieless="false" timeout="100">

page_load()
{
Response.AddHeader("Refresh", Convert.ToString((Session.Timeout * 60) - 60));
}

推荐答案

您可以在配置文件中设置会话超时:



You can set session timeout in your config file :

<system.web>
 <sessionstate mode="InProc" cookieless="false" timeout="80" />
</system.web>





或者在代码隐藏中你可以使用下面的代码设置:





Or in codebehind you can set using below code :

Session.Timeout = 80;


添加



Add

<sessionState timeout="540"/>





同时将app pool idle timeout设置为如果使用IIS 6,则需要timelimit。



Timeout属性不能设置为大于525,600分钟(1年)的值。默认值为20分钟。



缺点:如果您有大量用户并且会话超时增加,您将遇到性能问题,您的非活动会话将保留在Web服务器内存可能导致应用程序池回收,这将导致所有用户丢失所有会话。



Also set the app pool idle timeout to required timelimit if using IIS 6.

The Timeout property cannot be set to a value greater than 525,600 minutes (1 year). The default value is 20 minutes.

Disadvantage: You will have performance issues if you have large number of users and with increase in session timeout, your inactive sessions will remain in Web server memory which may cause application pool to recycle, which would result in loosing all sessions for all users.


这篇关于我希望会话活着吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆