Go Back   CodingForums.com > :: Server side development > ASP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-16-2005, 04:25 PM   PM User | #1
Spudhead
Senior Coder

 
Spudhead's Avatar
 
Join Date: Jun 2002
Location: London, UK
Posts: 1,856
Thanks: 8
Thanked 110 Times in 109 Posts
Spudhead is on a distinguished road
What's happening to my session variables?

Is there something about session variables accross directories? I know that sounds daft, but I don't get this:

www.mysite.com/directory/test.asp
Code:
<%
session("foo")="one"
response.write(session("foo"))
response.write(session("baa"))
%>

www.mysite.com/different_directory/test.asp
Code:
<%
session("baa")="two"
response.write(session("foo"))
response.write(session("baa"))
%>

No matter how many times I hit those pages in succession, neither page can see the session variable that the other one is populating. Why?
Spudhead is offline   Reply With Quote
Old 08-16-2005, 06:39 PM   PM User | #2
nikkiH
Senior Coder

 
nikkiH's Avatar
 
Join Date: Jun 2005
Location: Near Chicago, IL, USA
Posts: 1,973
Thanks: 1
Thanked 32 Times in 31 Posts
nikkiH is on a distinguished road
ASP thinks it's a new application unless you specifically set them up to share with Global.asa.
__________________

If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
Bored? Visit
http://www.kaelisspace.com/
nikkiH is offline   Reply With Quote
Old 08-17-2005, 03:05 AM   PM User | #3
miranda
Senior Coder

 
Join Date: Dec 2002
Location: Arlington, Texas USA
Posts: 1,062
Thanks: 4
Thanked 8 Times in 8 Posts
miranda is an unknown quantity at this point
do you allow unwritten cookies in your browser settings?

you dont need the global.asa file but if you have <%@ ENABLESESSIONSSTATE = False %> at the top of your page then you will get a new session id with each page and therefore will not be able to carry session variables from page to page.


If i remember correctly if you have that on one page and then change pages the value will remain false until which time you have a page with <%@ ENABLESESSIONSSTATE = True %> at which point you should be able to start using session variables again.
miranda is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 11:29 PM.


Advertisement
Log in to turn off these ads.