View Full Version : Intermitent login problems...
AlanUK78
05-13-2006, 05:36 PM
Hello all!
I'm looking for someone who can help me... I run a website dedicated to virtual flying. It has been running for 7 years now, but recently, my webhosting company changed their servers and since then, I have a recurrent problem with user login:
The user can always login without a problem
But it seems the session runs out immediately, and whenever the user wants to access anything else that requires a link to the database, the website asks for the user to log in again! This problem is intermitent! :S
If someone is willing to help, I would be very grateful, and would offer them access to the website in order to sort things out. I believe it has something to do with my global.asa file... There will be a reward too!! :thumbsup:
Thank you all for reading, get in touch!
degsy
05-15-2006, 04:21 PM
Wouldn't you be better off contacting the host and asked what has changed?
AlanUK78
05-15-2006, 07:16 PM
I have... they directed me to the following article:
http://support.microsoft.com/?kbid=172864
This is the email I got:
Hello, this is Emile. The fix for your asp session problem requires some
action on your part. On the old server your site was hosted on IIS5/Windows 2000 server. In new platform, it is hosted on IIS6/Windows 2003 servers which has shortcoming with relation to maintaining ASP session when global.asa is present in the web directory.
According to http://support.microsoft.com/?kbid=172864 Microsoft itself has confirmed it (ASP session issue) to be a bug with IIS6 and ASP session. They are suggesting the solution would be to get rid of global.asa file refer those functions thru an ASP file as includes. We are sorry that we were unable to fix your issue because of that bug with Microsoft, but the issue is fixable.
----------
This is all chinese to me! Help!
degsy
05-16-2006, 04:47 PM
What session code do you have in your global.asa that you couldn't put in a constant include file?
AlanUK78
05-16-2006, 04:58 PM
That's why I need help degsy, because I'm clueless at ASP, someone did all this for me years ago... but now because of this upgrade, it's all gone wrong :(
miranda
05-16-2006, 08:08 PM
post your global.asa code here and I (or someone else) can help you
AlanUK78
05-16-2006, 11:50 PM
ok here it is... Hope it helps!
<SCRIPT LANGUAGE=VBScript RUNAT=Server>
'You can add special event handlers in this file that will get run automatically when
'special Active Server Pages events occur. To create these handlers, just create a
'subroutine with a name from the list below that corresponds to the event you want to
'use. For example, to create an event handler for Session_OnStart, you would put the
'following code into this file (without the comments):
'Sub Session_OnStart
'**Put your code here **
'End Sub
'EventName Description
'Session_OnStart Runs the first time a user runs any page in your application
'Session_OnEnd Runs when a user's session times out or quits your application
'Application_OnStart Runs once when the first page of your application is run for the first time by any user
'Application_OnEnd Runs once when the web server shuts down
sub Application_onStart
'Application("BVAConnectString") = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath ("../../database/bva.mdb") & ";"
Application("BVAConnectString") = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\html\users\bvaircom\database\bva.mdb;"
end sub
sub Session_onStart
Session.LCID = 2057
Session("PilorID") = -1
end sub
</SCRIPT>
Thanks!
miranda
05-19-2006, 02:46 AM
ok here it is... Hope it helps!
<SCRIPT LANGUAGE=VBScript RUNAT=Server>
'You can add special event handlers in this file that will get run automatically when
'special Active Server Pages events occur. To create these handlers, just create a
'subroutine with a name from the list below that corresponds to the event you want to
'use. For example, to create an event handler for Session_OnStart, you would put the
'following code into this file (without the comments):
'Sub Session_OnStart
'**Put your code here **
'End Sub
'EventName Description
'Session_OnStart Runs the first time a user runs any page in your application
'Session_OnEnd Runs when a user's session times out or quits your application
'Application_OnStart Runs once when the first page of your application is run for the first time by any user
'Application_OnEnd Runs once when the web server shuts down
sub Application_onStart
'Application("BVAConnectString") = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath ("../../database/bva.mdb") & ";"
Application("BVAConnectString") = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\html\users\bvaircom\database\bva.mdb;"
end sub
sub Session_onStart
Session.LCID = 2057
Session("PilorID") = -1
end sub
</SCRIPT>
Thanks!
Most of the code is commented out. The only things that aren't are the connection string, the localeID and a session variable called pilorID
you can put all of these into an include file and reference them from there.
this will require referencing the include file on each page that has a database connection.
ghell
05-20-2006, 10:44 PM
I always just have an include file with common functions in and have this somewhere in it
Dim objConn
Sub OpenConn()
Err.Clear
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "..."
'--Throws -2147467259 if cant connect to database
'--Throws -2147217843 if invalid login
End Sub
Sub CloseConn()
If IsObject(objConn) Then
If objConn.State = adStateOpen Then objConn.Close
Set objConn = Nothing
End If
End Subthe adStateOpen is an ado constant found in adovbs.inc (http://www.4guysfromrolla.com/webtech/code/adovbs.txt) which equals to 1 (in there its listed as &H00000001 but thats just the hex for 1 [0x00000001] as 4 bytes (which in asp is a long not an int))
you may wish to put extra logic in for what happens if someone uses
Call OpenConn()
Call OpenConn()
or something to that effect, to either close the current connection if its open with
If IsObject(objConn) Then If objConn.State = adStateOpen Then objConn.Close
or to just not do anything and assume the 2nd call is redundant.
the Err.Clear clears any outstanding error messages you have if you have On Error Resume Next instead of On Error Goto 0 (default) so that you can check for errors after running that open subroutine if you want.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.