会话注销问题 [英] Session logout problem
问题描述
专家,
我是Uday Satardekar,
在我的web.config文件中,我设置会话超时,如下所示
Hi Expert,
I am Uday Satardekar,
In my web.config file i set session timeout like following
<sessionState timeout="120"
cookieless="false"
mode="InProc"
/>
但很多时间会在10-15分钟后自动终止.
有时候对我来说很好.
我在每个浏览器中都观察到了这个问题.
我在web.config文件中设置了以下配置.
but many times after 10-15 mins session expired automatically.
some times it working fines for me.
I observed this problem in every browser.
i set following configuration in web.config file.
<machineKey validationKey="7F962D9FAC5BA3E79A71E722B0FD79BAF52618501DABB750004795CFFDF1AC6BD66BA5FF028DE94730C2FBA150C8A049CC7B35B2CE4CC60BEF0AE47B36CBA5DF" decryptionKey="F6572AF020B96CB22ED4B987E2C0DB0DA6E68493A7F07C6F37F574907F91FDA6" validation="SHA1" decryption="AES"/>
<trace enabled="false" pageOutput="false" requestLimit="15" mostRecent="false"/>
<compilation debug="true">
<validation validateIntegratedModeConfiguration="false"/>
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="30.00:00:00"/>
</staticContent>
以上是web.config文件中的一些内容.
请帮助我解决此问题.
在此先感谢..................................
Above are some imp sestting in web.config file.
please help me to sort out this problem.
Thanks in advance.........................
推荐答案
您好,请在下面的JS中使用代码:
Hi, use below JS code:
<script language="javascript" type="text/javascript">
var sessionTimeoutWarning = 1;
var sessionTimeout = '<%= Session.Timeout %>';
//alert(sessionTimeout);
var sTimeout = parseInt(sessionTimeoutWarning) * 60 * 1000;
// setTimeout('SessionWarning()', sTimeout);
setTimeout('SessionWarning()', sessionTimeout);
function SessionWarning() {
var img = new Image(1, 1);
img.src = '<%= System.Configuration.ConfigurationSettings.AppSettings["SitePath"].ToString()%>/KeepAlive.aspx?date=' + escape(new Date());
// var message = "Your session will expire in another " +
// (parseInt(sessionTimeout) - parseInt(sessionTimeoutWarning)) +
// " mins! Please Save the data before the session expires";
// alert(message);
}
</script>
制作一个新页面KeepAlive.aspx.它是空白页.
如果这是您的解决方案,请不要忘记标记. :-)
make a new page KeepAlive.aspx. it is a blank page.
Don''t forget to mark, if it is your solution. :-)
这篇关于会话注销问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!