Session Variables

Discussion in 'Classic ASP' started by Bruce, Aug 24, 2003.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. Bruce

    Bruce DiscountASP.NET Staff

    What do you mean by session fails to hold?

    Can you elaborate?
    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">
     
  2. 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
     
  3. 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
     
  4. Bruce

    Bruce DiscountASP.NET Staff

    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



    quote:Originally posted by robsecord

    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">
     
  5. 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
     
  6. 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
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page