IIS 7 Classic ASP session for website, website sub

2019-08-17 10:52发布

问题:

Environment: Win server 2008 R2, IIS 7.5

Website:

MainWebsite

MainWebsite\Subdirectory

MainWebsite\VirtualDirectory

For MainWebsite - ASP -> (Session Properties) -> Time-Out -> 00:04:00

For MainWebsite\Subdirectory -> ASP -> (Session Properties) -> Time-Out -> 00:08:00

AppPool -> (Process Model) -> Idle Time-Out (minutes) -> 10 [I set it to 10 minute]

Requirement:

I want the MainWebsite to hold the session for 4 minutes.

I want the MainWebsite\Subdirectory to hold the session for 8 minutes.

The above configuration is kind of a tiny test I am doing, so I could replace the time-out values with 20 mintues or 30 mintues on my real prod environment.

The issue is, the Session time out setting for the "Mainwebsite\subdirectory" is not effective. Though it is set to 8 minutes, the session is lost after every 4 minutes, where 4 minutes is the setting of the MainWebsite.

Is this the expected behaviour, then I dont understand why there is an option to configure the ASP Session Timeout on a subdirectory level.

Let me know if you need more information. Appreciate your comments.

回答1:

Since this is being done in IIS it does make sense how it's working. Your timing out the whole site including the subdirectories before the subdirectory is timed out. The reason you can set it is if you want to time out the sub directory before the main level. I would recommend using asp code to timeout the session. You can set it in your global.asa so it's done at the global level for each session.

<%
Session.Timeout = 40
%>

where 40 = the number of minutes.

Reference: http://classicasp.aspfaq.com/general/how-do-i-increase-timeout-values.html