|
-
Jan 12th, 2003, 09:38 AM
#1
Thread Starter
New Member
Session object
I'm having this problem of passing session object. When i move from one hyperlink to another, my session object becomes empty.
say:
in page1.aspx
Session("isValid") = True
and when i clicked on the hyperlink
<a href=page2.aspx></a>
it still goes to page2 but I can't get the value of Session("isValid"), when i try to trace it, it is empty.
I've tried using response.redirect, but still the same prob.
so, how can i pass session around the pages?
-
Jan 12th, 2003, 02:15 PM
#2
PowerPoster
In your web.config file, there should be a tag with an attribute that lets you turn on/off session state management. Make sure this switch isn't set to false.
-
Jan 12th, 2003, 09:11 PM
#3
Thread Starter
New Member
I've check, It is on....
I'm totally confused....
-
Jan 13th, 2003, 09:47 AM
#4
Member
post your code if you don't mind...i too have been working with session objects recently and have had good luck passing and retaining values...
Ooogs
-
Jan 15th, 2003, 03:22 AM
#5
Lively Member
Try to use relative path e.g. ./ and ../
-
Jan 16th, 2003, 01:39 AM
#6
Thread Starter
New Member
I started with the login page where user enter password and id, this is how i set the session object if the user exist.
Dim objComm As New SqlCommand(strSQL, objConn) ' Reserve space in memory 'for the SqlCommand object
Dim objReader As SqlDataReader
Try
objConn.Open()
objReader = objComm.ExecuteReader()
If objReader.Read() = False Then
Session("Invalid") = "True"
Return False
Else
Session("Invalid") = ""
Session("LoggedIn") = "True"
Session("UserID") = objReader.Item("UserID").ToString
Session("Category") = objReader.Item("Mem_Category").ToString
Return True
End If
Finally
End Try
objReader.Close()
objConn.Close()
Then, i transfer the user to different page according to their member category by using server.transfer.
server.transfer("Member.aspx")
in Member.aspx page, I still manage to retrieve all info in the Session object, including session("userID").
but when i clicked on a hyperlink that link to another page, it show error that object reference not set to an instance of object in this line of code
" dim str
str= session("UserID")"
btw, the hyperlink is inside a user control, does it matter?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|