PDA

View Full Version : Session Variables


bruce
08-24-2003, 12:55 AM
What do you mean by session fails to hold?

Can you elaborate?
[b]quote:Originally posted by robsecord


My Session variables fail to hold their values accross page changes.

In my index.asp page, I write a value to a Session variable, then redirect to a different page.. Within the second page, my session variable is empty and so my code doesn't work properly.

Is there a specific way to use Session variables on DiscountASP.NET?

I also created a global.asa file with my session variables and placed it in the root directory of my site. Though the session variables are still empty [:(].

Could someone please tell me what is going on?

R. Secord, B.Sc., CTO MorphixTech
</blockquote id="quote"></font id="quote">

robsecord
08-24-2003, 02:30 AM
[b]quote:Originally posted by bruce

What do you mean by session fails to hold?

Can you elaborate?
</blockquote id="quote"></font id="quote">

Well, for example, when I store a value (a String) into a Session variable on the index.asp page and then redirect to start.asp (via Response.Redirect) the session variable is empty when I call for it in start.asp.

My code in index.asp looks like: Session("pollAnswered") = "no"

Then my code in start.asp checks the value in the session variable to determine if the poll has been answered (which at first should still be "no") but it is empty when I get to start.asp

My code in start.asp looks like:

If Session("pollAnswered") = "no" Then
...
Else
...
End If

But the value in the Session variable = ""

Basically, the value I store in the session variable in index.asp, is empty when i get to start.asp. Why is this?

Just to be more clear, my root is ht_docs but my Application resides in another folder within ht_docs. (ht_docs/cwp_temp)
Within cwp_temp/ is a file called index.asp (where I write an initial value to Session("pollAnswered")), then I redirect to a file called start.asp within the same folder (ht_docs/cwp_temp), but start.asp doesn't receive the value held in Session("pollAnswered")[?][:(]



R. Secord, B.Sc., CTO MorphixTech

robsecord
08-24-2003, 07:02 AM
My Session variables fail to hold their values accross page changes.

In my index.asp page, I write a value to a Session variable, then redirect to a different page.. Within the second page, my session variable is empty and so my code doesn't work properly.

Is there a specific way to use Session variables on DiscountASP.NET?

I also created a global.asa file with my session variables and placed it in the root directory of my site. Though the session variables are still empty [:(].

Could someone please tell me what is going on?

R. Secord, B.Sc., CTO MorphixTech

bruce
08-25-2003, 07:09 AM
Can you create couple simple pages

1) SetSession.asp

<%

Session("test") = "helloworld"

%>

2) GetSession.asp

<%

response.write session("test")

%>

Put this in your webroot and see if it works



[b]quote:Originally posted by robsecord

[b]quote:Originally posted by bruce

What do you mean by session fails to hold?

Can you elaborate?
</blockquote id="quote"></font id="quote">

Well, for example, when I store a value (a String) into a Session variable on the index.asp page and then redirect to start.asp (via Response.Redirect) the session variable is empty when I call for it in start.asp.

My code in index.asp looks like: Session("pollAnswered") = "no"

Then my code in start.asp checks the value in the session variable to determine if the poll has been answered (which at first should still be "no") but it is empty when I get to start.asp

My code in start.asp looks like:

If Session("pollAnswered") = "no" Then
...
Else
...
End If

But the value in the Session variable = ""

Basically, the value I store in the session variable in index.asp, is empty when i get to start.asp. Why is this?

Just to be more clear, my root is ht_docs but my Application resides in another folder within ht_docs. (ht_docs/cwp_temp)
Within cwp_temp/ is a file called index.asp (where I write an initial value to Session("pollAnswered")), then I redirect to a file called start.asp within the same folder (ht_docs/cwp_temp), but start.asp doesn't receive the value held in Session("pollAnswered")[?][:(]



R. Secord, B.Sc., CTO MorphixTech
</blockquote id="quote"></font id="quote">

Timbo
08-26-2003, 08:03 AM
have you tried

if Session("MySetting") == "No"

if you use single =, the session variable will be set to the camparison you are making

Trivial but i've fallen over here in the past

robsecord
08-29-2003, 08:50 AM
Thx Guys,

I finally got it to work.. I created my global.asa file in the root and my Session and Application variables both work fine now.
I think I had a problem in my global.asa file at first.. [B)]

I would still like to thank you guys tho for your input.. very thoughtful! [;)][:)]

R. Secord, B.Sc., CTO MorphixTech