If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Session Variables Lost

Reply
 
LinkBack Thread Tools Display Modes
  #16 (permalink)  
Old 03-04-03, 21:12
hktang hktang is offline
Registered User
 
Join Date: Nov 2002
Location: Singapore
Posts: 17
Quote:
Originally posted by rhs98
I did mean on the server...but hey, I don't even know why it would be useful.

hktang, your code does not look complete; the signup.asp uses a variable to redirect that is not listed, also member.asp that you include.

member.asp

<%
Class Member

Private varMemberID

Public Property Get memberID()
memberID = varMemberID
End Property

Public Function memberLogin(inputEmail, inputPassword)

strSQL = "exec memberLogin '" & inputEmail & "', '" & inputPassword & "'"
Set objMember = objConnection.Execute(strSQL)

If objMember.EOF Then
memberLogin = False

varMemberID = 0
Else
memberLogin = True

varMemberID = objMember("memberID")
End If

objMember.Close
Set objMember = Nothing
End Function

End Class
%>


Access Query
SELECT [memberID]
FROM member WHERE emailaddress=[@inputEmail] And password=[@inputPassword];



The varRedirectURL variable in signup.asp
If a user didn't signin first and click on member profile, the varRedirectURL variable will be something like this :
varRedirectURL = "/profile.asp"

Last edited by hktang; 03-04-03 at 21:15.
Reply With Quote
  #17 (permalink)  
Old 06-06-03, 14:22
grawgf grawgf is offline
Registered User
 
Join Date: Jun 2003
Posts: 1
Re: Session Variables Lost

I was having the same problem! Here is what I've found after long search: (found here (http://www.avdf.com/oct97/art_id002.html)

"Help, my Session variables disappeared!" Actually, that's probably what they were "supposed" to do (ahem!). If you change virtual directory or server, ASP allocates a new Session ID. Which sort of makes sense… and sort of doesn't. The net effect is that, for session variables to be maintained, you must stay within a directory (and its subdirectories).

Your redirect is probably changing directories too. I'm going to move my pages to the root and see if that helps. Good Luck! Gerard

If
Quote:
Originally posted by hktang
Hi people,

I have a problem with session variables lost while redirecting to other pages.
What the codes does is to ask the user to sign in. If success authenticate the user, member ID will be assign to the session. And the next page will do a check on member ID in session.


Sign-in page :
- The usual form asking for password and email


Login page :
<%
If Success Login Then
Session("memberID") = Member ID
Response.Redirect "Page 1"
Else
Response.Redirect "login.asp?mode=2"
End If
%>


Page 1 :
<%
If Session("memberID") = 0 Then
Response.Redirect "login.asp?mode=1"
End If
%>


So, page 1 simply enforce user to login before viewing its content. The problem here is, in login page, the member ID does exists in session. But while redirecting over to Page 1, the member ID is lost !


I have got a few facts over the web, which does not apply in my case.

1. There are no Session.abandon been called in anywhere. No way the session data can be cleared away.
2. My server is on a workgroup and has no invalid characters ( refer http://support.microsoft.com/default...b;EN-US;316112 for one of the possible caused of session not persist)
3. The value does exists and stay in session while I am in login.asp... it just never stay alive till the next page.
4. I have testing on a few different PC and the same problem occurs
5. I use no frame for the webpages ( refer http://support.microsoft.com/default...;en-us;q178037 - this is applicable to IE 4,5 only)
6. Yes, the browser is cookies enabled
7. The pages are tested locally, never go through any firewall (I have read somewhere that ASP session might lost while travelling through firewall)
8. Standard session timeout : 20 minutes

All the server I have tested is running Win2k Server, IIS5, IE6.


Any idea what went wrong? Please advise.

Thanks in advance.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On