超时设置前ASP会话到期

时间:2021-07-23 05:05:22

Some of my legacy program is using ASP (not ASP.Net), and even if I set long session expire time, for example to 20 minutes, sometimes in short time (e.g. in several minutes) I will still notice session expire error box –

我的一些遗留程序是使用ASP(而不是ASP.Net),即使我设置长会话过期时间,例如20分钟,有时在短时间内(例如在几分钟内),我仍会注意到会话过期错误框 -

"too much idle time, please login again."

“空闲时间过长,请再次登录。”

Any ideas to analyze further? Not sure whether it is my code bug or server (browser) configuration issue, since not all client/server combinations are met with this strange issue.

有什么想法要进一步分析?不确定这是我的代码错误还是服务器(浏览器)配置问题,因为并非所有客户端/服务器组合都遇到这个奇怪的问题。

The session expire box is triggered by my code:

会话过期框由我的代码触发:

<%
    if session("timeToken") = "" then
%>

<script language = "JavaScript">
<!--
window.alert ("too much idle time, please login again");
//-->
</script>
<%
response.End()
end if
%>

4 个解决方案

#1


Make sure you site stays in the same case sensitive folders

确保您的站点保留在相同的区分大小写的文件夹中

e.g.

http://myserver.com/MyWebSite/

does not have the same session cookie as

没有相同的会话cookie

http://myserver.com/mywebsite/

So it would log you out.

所以它会让你退出。

#2


It could be the IIS limitation on your application seesion timeout.

它可能是您的应用程序视频超时的IIS限制。

Try this:

  1. Right click on you app folder in IIS
  2. 右键单击IIS中的app文件夹

  3. Then go Properties -> Virtual Directory Tab -> Then the Configuration Button on the right bottom
  4. 然后转到属性 - >虚拟目录选项卡 - >然后右下角的配置按钮

  5. If it's disabled, then create the application first clicking the button Create
  6. 如果已禁用,则首先单击“创建”按钮创建应用程序

  7. Under the configuration window click on the Options tab and you will find SESSION TIMEOUT set by default to 20(mins)
  8. 在配置窗口下单击选项选项卡,您会发现SESSION TIMEOUT默认设置为20(分钟)

hope this is the aswer to your prayers :)

希望这是你祈祷的aswer :)

#3


Check that the application pool your app runs in is not recycling for some reason. For example does it have a more aggressive idle timeout (in a test scenario you may be the only on using the app and hence your not using it constitutes not just an idle session but an idle application).

检查您的应用运行的应用程序池是否因某些原因而无法回收。例如,它有一个更积极的空闲超时(在测试场景中,您可能是唯一使用该应用程序,因此您不使用它不仅构成空闲会话而且构成空闲应用程序)。

The all sorts of different reasons that tha app pool can be configured for that will trigger a recycle.

可以为其配置应用程序池的各种不同原因将触发回收。

Check the event logs when you have an unexcepted timeout, does anything look unusual there?

当您有一个未触发的超时时检查事件日志,那里看起来有什么异常吗?

#4


A couple of ideas based on your update:

基于您的更新的一些想法:

  1. Is there another reason your session("timeToken") could be empty? Another piece of code somewhere or perhaps the variable was misspelled somewhere?

    你的会话(“timeToken”)可能是空的还有另一个原因吗?在某个地方或者变量的另一段代码在某处拼错了?

  2. How does the actual value of session("timeToken") change in your code? Is it set when the session starts? Is it updated periodically? What value does it store?

    会话的实际值(“timeToken”)如何在代码中发生变化?是否在会话开始时设置?是否定期更新?它存储了什么价值?

The code you've written seems to be fine, so if it's not a code issue it will likely be a genuine session problem... just some things to check first.

您编写的代码似乎没问题,所以如果它不是代码问题,那么它可能是一个真正的会话问题......首先要检查一些事情。

Updates:

  • ASP session state is generally maintained using cookies - could you check that the client has cookies enabled?
  • ASP会话状态通常使用cookie维护 - 您是否可以检查客户端是否启用了cookie?

  • Is the ASP application served by more than one server? If it's being served from a web farm or cluster, you'll need to make sure that session state can persist across the machines or that a user's session is "sticky" - that is, it's always served by the same server.
  • ASP应用程序是否由多个服务器提供服务?如果它是从Web场或群集提供的,则需要确保会话状态可以在计算机上保留,或者用户的会话是“粘性的” - 也就是说,它始终由同一服务器提供服务。

More information and help can be found here: http://msdn.microsoft.com/en-us/library/ms972338.aspx

可以在此处找到更多信息和帮助:http://msdn.microsoft.com/en-us/library/ms972338.aspx

#1


Make sure you site stays in the same case sensitive folders

确保您的站点保留在相同的区分大小写的文件夹中

e.g.

http://myserver.com/MyWebSite/

does not have the same session cookie as

没有相同的会话cookie

http://myserver.com/mywebsite/

So it would log you out.

所以它会让你退出。

#2


It could be the IIS limitation on your application seesion timeout.

它可能是您的应用程序视频超时的IIS限制。

Try this:

  1. Right click on you app folder in IIS
  2. 右键单击IIS中的app文件夹

  3. Then go Properties -> Virtual Directory Tab -> Then the Configuration Button on the right bottom
  4. 然后转到属性 - >虚拟目录选项卡 - >然后右下角的配置按钮

  5. If it's disabled, then create the application first clicking the button Create
  6. 如果已禁用,则首先单击“创建”按钮创建应用程序

  7. Under the configuration window click on the Options tab and you will find SESSION TIMEOUT set by default to 20(mins)
  8. 在配置窗口下单击选项选项卡,您会发现SESSION TIMEOUT默认设置为20(分钟)

hope this is the aswer to your prayers :)

希望这是你祈祷的aswer :)

#3


Check that the application pool your app runs in is not recycling for some reason. For example does it have a more aggressive idle timeout (in a test scenario you may be the only on using the app and hence your not using it constitutes not just an idle session but an idle application).

检查您的应用运行的应用程序池是否因某些原因而无法回收。例如,它有一个更积极的空闲超时(在测试场景中,您可能是唯一使用该应用程序,因此您不使用它不仅构成空闲会话而且构成空闲应用程序)。

The all sorts of different reasons that tha app pool can be configured for that will trigger a recycle.

可以为其配置应用程序池的各种不同原因将触发回收。

Check the event logs when you have an unexcepted timeout, does anything look unusual there?

当您有一个未触发的超时时检查事件日志,那里看起来有什么异常吗?

#4


A couple of ideas based on your update:

基于您的更新的一些想法:

  1. Is there another reason your session("timeToken") could be empty? Another piece of code somewhere or perhaps the variable was misspelled somewhere?

    你的会话(“timeToken”)可能是空的还有另一个原因吗?在某个地方或者变量的另一段代码在某处拼错了?

  2. How does the actual value of session("timeToken") change in your code? Is it set when the session starts? Is it updated periodically? What value does it store?

    会话的实际值(“timeToken”)如何在代码中发生变化?是否在会话开始时设置?是否定期更新?它存储了什么价值?

The code you've written seems to be fine, so if it's not a code issue it will likely be a genuine session problem... just some things to check first.

您编写的代码似乎没问题,所以如果它不是代码问题,那么它可能是一个真正的会话问题......首先要检查一些事情。

Updates:

  • ASP session state is generally maintained using cookies - could you check that the client has cookies enabled?
  • ASP会话状态通常使用cookie维护 - 您是否可以检查客户端是否启用了cookie?

  • Is the ASP application served by more than one server? If it's being served from a web farm or cluster, you'll need to make sure that session state can persist across the machines or that a user's session is "sticky" - that is, it's always served by the same server.
  • ASP应用程序是否由多个服务器提供服务?如果它是从Web场或群集提供的,则需要确保会话状态可以在计算机上保留,或者用户的会话是“粘性的” - 也就是说,它始终由同一服务器提供服务。

More information and help can be found here: http://msdn.microsoft.com/en-us/library/ms972338.aspx

可以在此处找到更多信息和帮助:http://msdn.microsoft.com/en-us/library/ms972338.aspx