ASP href is resetting session variable, why?? HELP

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bobby

    #1

    ASP href is resetting session variable, why?? HELP

    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("O rderID") & _
    ">" & rsCustOrders("O rderID") & "</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("OrderI D") = Request("o")
    Response.Buffer = True
    Response.Clear
    Response.Redire ct Request("script _name") & _
    "?action=viewin fo&ordnum=" & Session("OrderI D")
    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?

  • Zifud

    #2
    Re: ASP href is resetting session variable, why?? HELP

    Bobby wrote:[color=blue]
    > 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("O rderID") & _
    > ">" & rsCustOrders("O rderID") & "</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("OrderI D") = Request("o")
    > Response.Buffer = True
    > Response.Clear
    > Response.Redire ct Request("script _name") & _
    > "?action=viewin fo&ordnum=" & Session("OrderI D")
    > 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?
    >[/color]

    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("O rderID") & _
    ">" & rsCustOrders("O rderID") & "</a>

    actually look like at the client?

    --
    Zif

    Comment

    • Bobby

      #3
      Re: ASP href is resetting session variable, why?? HELP

      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...der&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.

      Comment

      • Zifud

        #4
        Re: ASP href is resetting session variable, why?? HELP

        Bobby wrote:[color=blue]
        > Yes, I know this i JS newsgroup, I didn't know which ASP group to post.[/color]

        Hmm. Anything microsoft.publi c is kinda antsy, but

        microsoft.publi c.inetserver.as p.general

        may suit.
        [color=blue]
        > When you bring the mouse over to the OrderID, it looks like this:
        > http://www.mytestserver.com/vueorder...der&ordnum=146.[/color]
        [...]

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

        --
        Zif

        Comment

        • Jeff North

          #5
          Re: ASP href is resetting session variable, why?? HELP

          On 23 Feb 2005 20:31:40 -0800, in comp.lang.javas cript "Bobby"
          <bikmann@gmail. com> wrote:
          [color=blue]
          >| 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("O rderID") & _
          >| ">" & rsCustOrders("O rderID") & "</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("OrderI D") = Request("o")
          >| Response.Buffer = True
          >| Response.Clear
          >| Response.Redire ct Request("script _name") & _
          >| "?action=viewin fo&ordnum=" & Session("OrderI D")
          >| 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?[/color]

          How have you set your session variable?
          Session("Login" ) = 1
          or
          Session("Login" ) = "1"
          ---------------------------------------------------------------
          jnorthau@yourpa ntsyahoo.com.au : Remove your pants to reply
          ---------------------------------------------------------------

          Comment

          • Bobby

            #6
            Re: ASP href is resetting session variable, why?? HELP

            First, don't click on the hyperlink, 'cause that mytestserver.co m 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.Redire ct
            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).

            Comment

            • Bobby

              #7
              Re: ASP href is resetting session variable, why?? HELP

              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.

              Comment

              • Evertjan.

                #8
                Re: ASP href is resetting session variable, why?? HELP

                Bobby wrote on 25 feb 2005 in comp.lang.javas cript:
                [color=blue]
                > 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.[/color]

                what nonsense, the session stays for me.

                [color=blue]
                > The approach to fix this is to create a cookie without expiration,
                > hence it will remain in memory.[/color]

                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)

                Comment

                • Jeff North

                  #9
                  Re: ASP href is resetting session variable, why?? HELP

                  On 25 Feb 2005 07:55:39 -0800, in comp.lang.javas cript "Bobby"
                  <bikmann@gmail. com> wrote:
                  [color=blue]
                  >| 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.[/color]

                  Can you give the url of the article?
                  An anchor tag shouldn't upset session variables.
                  [color=blue]
                  >| The approach to fix this is to create a cookie without expiration,
                  >| hence it will remain in memory.[/color]

                  ---------------------------------------------------------------
                  jnorthau@yourpa ntsyahoo.com.au : Remove your pants to reply
                  ---------------------------------------------------------------

                  Comment

                  • Mike D

                    #10
                    Re: ASP href is resetting session variable, why?? HELP

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

                    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.



                    *** Sent via Developersdex http://www.developersdex.com ***
                    Don't just participate in USENET...get rewarded for it!

                    Comment

                    • Evertjan.

                      #11
                      Re: ASP href is resetting session variable, why?? HELP

                      Mike D wrote on 26 feb 2005 in comp.lang.javas cript:
                      [color=blue]
                      > Try using a relative hyperlink rather than an absolute one
                      > (/vueorder.asp?ac tion=showorder& ordnum=146 rather than
                      > http://www.mytestserver.com/vueorder...er&ordnum=146).[/color]

                      This is not email, but usenet.
                      Without quoting where you are answering on, your answer is useless for
                      most.
                      [color=blue]
                      > 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.[/color]

                      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)

                      Comment

                      • Bobby

                        #12
                        Re: ASP href is resetting session variable, why?? HELP

                        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.

                        Comment

                        • Evertjan.

                          #13
                          Re: ASP href is resetting session variable, why?? HELP

                          Bobby wrote on 28 feb 2005 in comp.lang.javas cript:
                          [color=blue]
                          > 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.
                          >[/color]

                          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)

                          Comment

                          • Dr John Stockton

                            #14
                            Re: ASP href is resetting session variable, why?? HELP

                            JRS: In article <Xns960BBBD083D 52eejj99@194.10 9.133.29>, dated Mon, 28
                            Feb 2005 17:27:45, seen in news:comp.lang. javascript, Evertjan.
                            <exjxw.hannivoo rt@interxnl.net > posted :[color=blue]
                            >
                            >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.[/color]

                            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.demo n.co.uk/news-use.htm> : about usage of News.
                            No Encoding. Quotes before replies. Snip well. Write clearly. Don't Mail News.

                            Comment

                            • Evertjan.

                              #15
                              Re: ASP href is resetting session variable, why?? HELP

                              Dr John Stockton wrote on 28 feb 2005 in comp.lang.javas cript:[color=blue]
                              > JRS: In article <Xns960BBBD083D 52eejj99@194.10 9.133.29>, dated Mon,
                              > 28 Feb 2005 17:27:45, seen in news:comp.lang. javascript, Evertjan.
                              > <exjxw.hannivoo rt@interxnl.net > posted :[color=green]
                              >>
                              >>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.[/color]
                              >
                              > He's using Google. You need, IMHO, to explain how to get it right;
                              > and, IMHO, so does the FAQ.[/color]

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

                              [color=blue]
                              > Has the Google indentation problem been solved?[/color]

                              Google has an indentity crisis ?


                              --
                              Evertjan.
                              The Netherlands.
                              (Replace all crosses with dots in my emailaddress)

                              Comment

                              Working...