ASP href is resetting session variable, why?? HELP

Discussion in 'Javascript' started by Bobby, Feb 24, 2005.

  1. Bobby

    Bobby Guest

    I have this line, at this time the value of Session("Login") is 1:

    Response.Write "<a href=" & Request("script_name") & _
    "?action=show&o=" & rsCustOrders("OrderID") & _
    ">" & rsCustOrders("OrderID") & "</a>"

    Once you click on it, it refreshes the page and goes to the following
    section, and somehow the value of Session("Login") is 0, hence, it ends
    up in the ELSE trap:

    If Session("Login") = 1 Then
    If Trim(Request("o")) <> "" Then
    Session("OrderID") = Request("o")
    Response.Buffer = True
    Response.Clear
    Response.Redirect Request("script_name") & _
    "?action=viewinfo&ordnum=" & Session("OrderID")
    End If
    Else
    ... blah blah
    End If

    Can someone tell me why Session("Login") is rest to 0? Initial value
    in global.asa for this is set to 0. I can't figure it out why it would
    reset it.
    However, if I DO NOT use "<a href", it does not reset this?
    Bobby, Feb 24, 2005
    #1
    1. Advertising

  2. Bobby

    Zifud Guest

    Bobby wrote:
    > I have this line, at this time the value of Session("Login") is 1:
    >
    > Response.Write "<a href=" & Request("script_name") & _
    > "?action=show&o=" & rsCustOrders("OrderID") & _
    > ">" & rsCustOrders("OrderID") & "</a>"
    >
    > Once you click on it, it refreshes the page and goes to the following
    > section, and somehow the value of Session("Login") is 0, hence, it ends
    > up in the ELSE trap:
    >
    > If Session("Login") = 1 Then
    > If Trim(Request("o")) <> "" Then
    > Session("OrderID") = Request("o")
    > Response.Buffer = True
    > Response.Clear
    > Response.Redirect Request("script_name") & _
    > "?action=viewinfo&ordnum=" & Session("OrderID")
    > End If
    > Else
    > ... blah blah
    > End If
    >
    > Can someone tell me why Session("Login") is rest to 0? Initial value
    > in global.asa for this is set to 0. I can't figure it out why it would
    > reset it.
    > However, if I DO NOT use "<a href", it does not reset this?
    >


    I think you have the wrong newsgroup. This place is for
    JavaScript, not ASP.

    If your issue is with the JavaScript generated by your ASP page,
    then post whatever is received by the client, not the ASP code
    that generates it. In other words, what does:

    <a href=" & Request("script_name") & _
    "?action=show&o=" & rsCustOrders("OrderID") & _
    ">" & rsCustOrders("OrderID") & "</a>

    actually look like at the client?

    --
    Zif
    Zifud, Feb 24, 2005
    #2
    1. Advertising

  3. Bobby

    Bobby Guest

    Yes, I know this i JS newsgroup, I didn't know which ASP group to post.
    When you bring the mouse over to the OrderID, it looks like this:
    http://www.mytestserver.com/vueorder.asp?action=showorder&ordnum=146.
    When you click on the hyperlink, it then goes into the ELSE trap 'cause
    session variable now is set to 0. How I know my session variable
    values, I added an include file, that cycles through the session
    variable collection.
    Bobby, Feb 24, 2005
    #3
  4. Bobby

    Zifud Guest

    Bobby wrote:
    > Yes, I know this i JS newsgroup, I didn't know which ASP group to post.


    Hmm. Anything microsoft.public is kinda antsy, but

    microsoft.public.inetserver.asp.general

    may suit.

    > When you bring the mouse over to the OrderID, it looks like this:
    > http://www.mytestserver.com/vueorder.asp?action=showorder&ordnum=146.

    [...]

    Clicking on your link just gives a 404 message...

    --
    Zif
    Zifud, Feb 24, 2005
    #4
  5. Bobby

    Jeff North Guest

    On 23 Feb 2005 20:31:40 -0800, in comp.lang.javascript "Bobby"
    <> wrote:

    >| I have this line, at this time the value of Session("Login") is 1:
    >|
    >| Response.Write "<a href=" & Request("script_name") & _
    >| "?action=show&o=" & rsCustOrders("OrderID") & _
    >| ">" & rsCustOrders("OrderID") & "</a>"
    >|
    >| Once you click on it, it refreshes the page and goes to the following
    >| section, and somehow the value of Session("Login") is 0, hence, it ends
    >| up in the ELSE trap:
    >|
    >| If Session("Login") = 1 Then
    >| If Trim(Request("o")) <> "" Then
    >| Session("OrderID") = Request("o")
    >| Response.Buffer = True
    >| Response.Clear
    >| Response.Redirect Request("script_name") & _
    >| "?action=viewinfo&ordnum=" & Session("OrderID")
    >| End If
    >| Else
    >| ... blah blah
    >| End If
    >|
    >| Can someone tell me why Session("Login") is rest to 0? Initial value
    >| in global.asa for this is set to 0. I can't figure it out why it would
    >| reset it.
    >| However, if I DO NOT use "<a href", it does not reset this?


    How have you set your session variable?
    Session("Login") = 1
    or
    Session("Login") = "1"
    ---------------------------------------------------------------
    : Remove your pants to reply
    ---------------------------------------------------------------
    Jeff North, Feb 24, 2005
    #5
  6. Bobby

    Bobby Guest

    First, don't click on the hyperlink, 'cause that mytestserver.com is
    still not on public, only internal, hence error 404.

    I have been reading more on this. And have found where the problem
    lies, but still no solution yet. -- >> The problem lies with the state
    of my session.

    Although on my website, I have created session variables, some through
    global.asa and others on the fly. And I have been able to maintain my
    state, even when I had
    Response.Clear
    Response.Redirect
    statements. And it will maintain state. However, the problem lies
    when you do <A HREF, then immediately I loose state.

    The reason Session("Login") would go back to 0 (zero), was because my
    onStart section in global.asa starts of with zero, anytime a new
    session is started. Which explained, that when I dd not have
    Session("Login") in global.asa, upon executing <A HREF, my session
    variable would simply disappear, hence, telling me that my state is
    lost.

    Now, I need to find out, how can I maintain this state under <A HREF.
    (I have been reading more on cookies, and header info, there could be
    some sort of an answer there, but havent don't figured that out yet).
    Bobby, Feb 24, 2005
    #6
  7. Bobby

    Bobby Guest

    Well, since I have figured out the solution, I wanted to share that
    with everyone.

    An <a href tag in asp will loose session even though it is not using
    Frameset, as outlined my Microsoft knowledgebase, it affect those who'd
    use <a href tag.

    The approach to fix this is to create a cookie without expiration,
    hence it will remain in memory.
    Bobby, Feb 25, 2005
    #7
  8. Bobby

    Evertjan. Guest

    Bobby wrote on 25 feb 2005 in comp.lang.javascript:

    > Well, since I have figured out the solution, I wanted to share that
    > with everyone.
    >
    > An <a href tag in asp will loose session even though it is not using
    > Frameset, as outlined my Microsoft knowledgebase, it affect those who'd
    > use <a href tag.


    what nonsense, the session stays for me.


    > The approach to fix this is to create a cookie without expiration,
    > hence it will remain in memory.


    Same as above. You cannot fix, what not is broken.

    You cannot fix a lost session with a cookie.


    --
    Evertjan.
    The Netherlands.
    (Replace all crosses with dots in my emailaddress)
    Evertjan., Feb 25, 2005
    #8
  9. Bobby

    Jeff North Guest

    On 25 Feb 2005 07:55:39 -0800, in comp.lang.javascript "Bobby"
    <> wrote:

    >| Well, since I have figured out the solution, I wanted to share that
    >| with everyone.
    >|
    >| An <a href tag in asp will loose session even though it is not using
    >| Frameset, as outlined my Microsoft knowledgebase, it affect those who'd
    >| use <a href tag.


    Can you give the url of the article?
    An anchor tag shouldn't upset session variables.

    >| The approach to fix this is to create a cookie without expiration,
    >| hence it will remain in memory.


    ---------------------------------------------------------------
    : Remove your pants to reply
    ---------------------------------------------------------------
    Jeff North, Feb 26, 2005
    #9
  10. Bobby

    Evertjan. Guest

    Mike D wrote on 26 feb 2005 in comp.lang.javascript:

    > Try using a relative hyperlink rather than an absolute one
    > (/vueorder.asp?action=showorder&ordnum=146 rather than
    > http://www.mytestserver.com/vueorder.asp?action=showorder&ordnum=146).


    This is not email, but usenet.
    Without quoting where you are answering on, your answer is useless for
    most.

    > I think you will find that fixes the problem. it is not a problem with
    > href's it is just that absolute hyperlinks create a new session with
    > iis.


    Not true. The request to the server doesn't even differ.

    [Only if the specified domain differs, but that is another story]

    --
    Evertjan.
    The Netherlands.
    (Replace all crosses with dots in my emailaddress)
    Evertjan., Feb 26, 2005
    #10
  11. Bobby

    Bobby Guest

    Mike D., I will try that using Relative instead of Absolute.

    Evertjan, I posted after doing quite a bit of searches on this problem
    on the Internet on this issue. You will find I'm not the only one with
    this problem.

    Yes, as much bizzare this problem sees, and I'm not too happy using
    cookies either, but it helped resolved the question.

    Now, if using the relative solves this problem, I will remove using
    cookies.

    And BTW, some of my other pages use <a href, and session stays, but
    perhaps it could the fact I'm using query strings, I don't know. So
    I'm not 100% why it would happen.
    Bobby, Feb 28, 2005
    #11
  12. Bobby

    Evertjan. Guest

    Bobby wrote on 28 feb 2005 in comp.lang.javascript:

    > Mike D., I will try that using Relative instead of Absolute.
    >
    > Evertjan, I posted after doing quite a bit of searches on this problem
    > on the Internet on this issue. You will find I'm not the only one with
    > this problem.
    >


    Dear mike,

    This is not email but usenet.

    If you don't post relevant part of the posting you are replying on, as is
    according to usenet netiquette, we [in general] are obliged to search for
    it and the posting will not always be available on all news servers.

    --
    Evertjan.
    The Netherlands.
    (Replace all crosses with dots in my emailaddress)
    Evertjan., Feb 28, 2005
    #12
  13. JRS: In article <Xns960BBBD083D52eejj99@194.109.133.29>, dated Mon, 28
    Feb 2005 17:27:45, seen in news:comp.lang.javascript, Evertjan.
    <> posted :
    >
    >If you don't post relevant part of the posting you are replying on, as is
    >according to usenet netiquette, we [in general] are obliged to search for
    >it and the posting will not always be available on all news servers.


    He's using Google. You need, IMHO, to explain how to get it right; and,
    IMHO, so does the FAQ.

    Has the Google indentation problem been solved?

    --
    © John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME ©
    Web <URL:http://www.uwasa.fi/~ts/http/tsfaq.html> -> Timo Salmi: Usenet Q&A.
    Web <URL:http://www.merlyn.demon.co.uk/news-use.htm> : about usage of News.
    No Encoding. Quotes before replies. Snip well. Write clearly. Don't Mail News.
    Dr John Stockton, Feb 28, 2005
    #13
  14. Bobby

    Evertjan. Guest

    Dr John Stockton wrote on 28 feb 2005 in comp.lang.javascript:
    > JRS: In article <Xns960BBBD083D52eejj99@194.109.133.29>, dated Mon,
    > 28 Feb 2005 17:27:45, seen in news:comp.lang.javascript, Evertjan.
    > <> posted :
    >>
    >>If you don't post relevant part of the posting you are replying on, as
    >>is according to usenet netiquette, we [in general] are obliged to
    >>search for it and the posting will not always be available on all news
    >>servers.

    >
    > He's using Google. You need, IMHO, to explain how to get it right;
    > and, IMHO, so does the FAQ.


    If so, he should condform to netiquette and read the faq,
    and so should Google.


    > Has the Google indentation problem been solved?


    Google has an indentity crisis ?


    --
    Evertjan.
    The Netherlands.
    (Replace all crosses with dots in my emailaddress)
    Evertjan., Mar 1, 2005
    #14
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. CRON
    Replies:
    24
    Views:
    200,650
    Adrienne Boswell
    Jun 20, 2006
  2. Mr. SweatyFinger
    Replies:
    2
    Views:
    1,804
    Smokey Grindel
    Dec 2, 2006
  3. Soren Vejrum
    Replies:
    4
    Views:
    568
    Lasse Reichstein Nielsen
    Jul 5, 2003
  4. saiho.yuen
    Replies:
    3
    Views:
    416
    kaeli
    Sep 14, 2004
  5. Replies:
    2
    Views:
    457
Loading...

Share This Page