Avatar of lherrou
lherrou
Flag for Ukraine asked on

ASP script timeout / logout problem

I have a couple of ASP scripts running on a client's server (they have hosting through another provider, I need to be able to tell their host IT people what the problem is, so we can get it fixed.

For both of these scripts (a calendar and a shopping cart), to administer the script you must log in to a admin area, and then you can add, change, etc. These scripts have both worked fine in the past (the calendar script for months) but since late December have shown funny behavior - when you log in and start doing a task (such as adding an event to the calendar), within a short period of time you are logged out and must re-login. Unfortunately, when you log back in, you go to the main screen, and have to start over. The time to timeout or logout seems to be variable, sometimes as short as 10 seconds, other times almost a full minute. Sometimes that is enough to finish a task, and save to the database, and other times it's not.

The server is IIS6, with ASP.NET turned off. When I run a script to check the environment after logging in, among other things that may be relevant, I get:

Default session timeout is: 35 mins (increased by the login script currently, default is 20)
ASPSESSIONIDAQCTRQRC=[some session ID] (this session ID remains for 20 mins, although the user was timed out or signed out as described above.)

I am convinced that this is an enviroment or hosting error, and not an issue with my scripts (in part because they worked fine in the past, and I have used the calendar script for months on this server and others. The shopping carts script is from CyberStrong eShop, and they have not seen this problem before, nor did any of their suggestions fix it.

This is a single server, no load sharing or anything.

Any thoughts? Thanks!
ASP

Avatar of undefined
Last Comment
fritz_the_blank

8/22/2022 - Mon
fritz_the_blank

Perhaps you should set an explicit timeout on the page?

fritz_the_blank

<%Session.timeout = 300%>

at the top of the page where the number is the number of seconds.

FtB
SOLUTION
fritz_the_blank

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
lherrou

ASKER
Thanks, FtB, tried an explicit timeout and increasing the Session.timeout variable, previously. Now I've tried the Server.ScriptTimeout increase, and that didn't make a difference either. Any other thoughts?
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
fritz_the_blank

The only thing that stands out is you say since late December. This can't have anything to do with the year changing, can it?

FtB
lherrou

ASKER
Nope, it started somewhere between Dec 9th (when we can last document a successful use of one of the scripts, and Dec 20th, when we know for sure it wasn't working. No programming was changed during this period. Also, this problem occurs in different scripts with different approaches to being logged in. For example, for the calendar, you are logged in if you correctly enter the login and password, which sets calAdmin = 1. Every page after that gets an include which follows:

<%
      If Session("calAdmin") <> 1 Then
            Response.Redirect "invalid.asp"
      End If
%>

Then, there's a logout script which sets calAdmin = 0 if you run it.

So, somehow in a short period the session variable is lost, or is re-set to 0. The things that bug me is that it's a short but seemingly random time until that happens, and that the session cookie persists...

seb_gibbs

Server.ScriptTimeout is incorrect, this should only used when a page takes a long time to load.

You need this:

   Session.Timeout = 45 'mins

⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
lherrou

ASKER
Thanks, but I had tried increasing the Session.Timout, which when I show environment, shows the correct change (from 20 mins to 35 mins) but the problem persists. And, as I have said, why would the session timeout suddenly change behavior in a working script?

ASKER CERTIFIED SOLUTION
joeposter649

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
fritz_the_blank

@seb_gibbs:

Please look up: using Session.Timeout was the first thing that I suggested.

FtB
lherrou

ASKER
I found the problem. Thank you guys for your help, although it did not directly lead to the answer - at least got me thinking about some things that did lead to a solution. I am going to ask an Admin type to allow me to reduce the total points and then split them between FtB and JoePoster649 for their useful suggestions.

Alright, I don't know WHY this was a problem, but there was a section of the global.asa file that, once removed, remedied the problem.

Function FrontPage_FileExists(fspath)
      On Error Resume Next
      FrontPage_FileExists = False
      set fs = CreateObject("Scripting.FileSystemObject")
      Err.Clear
      set istream = fs.OpenTextFile(fspath)
      if Err.Number = 0 then
            FrontPage_FileExists = True
            istream.Close
      end if
      set istream = Nothing
      set fs = Nothing
End Function

Once I removed this, my scripts functioned normally. I also don't know why this suddenly started causing a problem in November, since the global asa file had not been changed since July, but I suspect (as I had all along) that the host changed an environmental setting somewhere or added/changed Front Page Extensions or something that led to the problem.

Thanks again for your suggestions.
Your help has saved me hundreds of hours of internet surfing.
fblack61
fritz_the_blank

You might want to check the virus software--it very frequently inteferes with the FSO and causes code to hang.

If lherrou is short on points and wants a reduction, that is fine.

FtB
lherrou

ASKER
FtB,

No antivirus software installed on that server, traffic is scanned by a firewall appliance, and the hosting machines are scanned by another machine in the intranet. But, it was thinking along those lines that led me to the solution.

LHerrou
joeposter649

If you need that code you should use FileExits instead of opening the file.
http://www.devguru.com/Technologies/vbscript/quickref/filesystemobject_fileexists.html
I think the problem was istream.Close being in the IF so the file was left open when there was no err.
Also, you should always do an "on error goto 0" after you check the Err.Number so subsequent errors are shown.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
fritz_the_blank

I am glad to have helped then.

FtB