Global Variables

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

    #1

    Global Variables

    What is the correct method to use if I want to store a variable within my
    web application, that is available to every single page within the
    application, but is lost when the user navigates to a page outside of the
    app.

    I don't want to use session variables because they only last a short period
    of time (and I'm NOT allowed to increase the session variable time on the
    web-server).

    TIA




  • Kevin Spencer

    #2
    Re: Global Variables

    You're SOL. How is the variable supposed to be lost when the user Session
    ends? For example, let's say that you use a Cookie instead, and don't set an
    expiration. What you've done is the equivalent of a client-side Session
    variable. When the Session ends, the Cookie will be destroyed. When does the
    Session end? When there are no requests for a new page from the same domain
    within a certain time period. If you don't use an object that times out when
    no requests for a page from the same domain are made, how are you going to
    determine the end of the Session? The browser doesn't inform the server that
    it's navigating away or closing. HTTP is stateless.

    What you need to do is USE Session, but use it wisely. Make sure your app
    includes code to handle what happens if the Session is lost due to
    inactivity and a new Session is started.

    --
    HTH,

    Kevin Spencer
    Microsoft MVP
    ..Net Developer
    All hotels in Benidorm. The best selection of Benidorm hotels with reviews and maps. Book in advance and save.

    Neither a follower nor a lender be.

    "J" <nospam> wrote in message news:eZvTq7WZDH A.628@TK2MSFTNG P10.phx.gbl...[color=blue]
    > What is the correct method to use if I want to store a variable within my
    > web application, that is available to every single page within the
    > application, but is lost when the user navigates to a page outside of the
    > app.
    >
    > I don't want to use session variables because they only last a short[/color]
    period[color=blue]
    > of time (and I'm NOT allowed to increase the session variable time on the
    > web-server).
    >
    > TIA
    >
    >
    >
    >[/color]


    Comment

    • James Zhuo

      #3
      Re: Global Variables

      Agree, but as to how that is done i am clueless.
      But what you describe certainly sounds like Session variable is the most
      logical of all
      Application variable is not so appropriate since it sounded like you wanted
      the variable
      to be user particular

      Cheers

      J

      "Kevin Spencer" <kevin@takempis .com> wrote in message
      news:e2MJCvYZDH A.1832@TK2MSFTN GP10.phx.gbl...[color=blue]
      > You're SOL. How is the variable supposed to be lost when the user Session
      > ends? For example, let's say that you use a Cookie instead, and don't set[/color]
      an[color=blue]
      > expiration. What you've done is the equivalent of a client-side Session
      > variable. When the Session ends, the Cookie will be destroyed. When does[/color]
      the[color=blue]
      > Session end? When there are no requests for a new page from the same[/color]
      domain[color=blue]
      > within a certain time period. If you don't use an object that times out[/color]
      when[color=blue]
      > no requests for a page from the same domain are made, how are you going to
      > determine the end of the Session? The browser doesn't inform the server[/color]
      that[color=blue]
      > it's navigating away or closing. HTTP is stateless.
      >
      > What you need to do is USE Session, but use it wisely. Make sure your app
      > includes code to handle what happens if the Session is lost due to
      > inactivity and a new Session is started.
      >
      > --
      > HTH,
      >
      > Kevin Spencer
      > Microsoft MVP
      > .Net Developer
      > http://www.takempis.com
      > Neither a follower nor a lender be.
      >
      > "J" <nospam> wrote in message news:eZvTq7WZDH A.628@TK2MSFTNG P10.phx.gbl...[color=green]
      > > What is the correct method to use if I want to store a variable within[/color][/color]
      my[color=blue][color=green]
      > > web application, that is available to every single page within the
      > > application, but is lost when the user navigates to a page outside of[/color][/color]
      the[color=blue][color=green]
      > > app.
      > >
      > > I don't want to use session variables because they only last a short[/color]
      > period[color=green]
      > > of time (and I'm NOT allowed to increase the session variable time on[/color][/color]
      the[color=blue][color=green]
      > > web-server).
      > >
      > > TIA
      > >
      > >
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • Kevin Spencer

        #4
        Re: Global Variables

        What exactly do you want to know?

        --
        HTH,

        Kevin Spencer
        Microsoft MVP
        ..Net Developer
        All hotels in Benidorm. The best selection of Benidorm hotels with reviews and maps. Book in advance and save.

        Neither a follower nor a lender be.

        "James Zhuo" <nano_electroni cs@optusnet.com .au> wrote in message
        news:Oe%23Fl2YZ DHA.1644@TK2MSF TNGP10.phx.gbl. ..[color=blue]
        > Agree, but as to how that is done i am clueless.
        > But what you describe certainly sounds like Session variable is the most
        > logical of all
        > Application variable is not so appropriate since it sounded like you[/color]
        wanted[color=blue]
        > the variable
        > to be user particular
        >
        > Cheers
        >
        > J
        >
        > "Kevin Spencer" <kevin@takempis .com> wrote in message
        > news:e2MJCvYZDH A.1832@TK2MSFTN GP10.phx.gbl...[color=green]
        > > You're SOL. How is the variable supposed to be lost when the user[/color][/color]
        Session[color=blue][color=green]
        > > ends? For example, let's say that you use a Cookie instead, and don't[/color][/color]
        set[color=blue]
        > an[color=green]
        > > expiration. What you've done is the equivalent of a client-side Session
        > > variable. When the Session ends, the Cookie will be destroyed. When does[/color]
        > the[color=green]
        > > Session end? When there are no requests for a new page from the same[/color]
        > domain[color=green]
        > > within a certain time period. If you don't use an object that times out[/color]
        > when[color=green]
        > > no requests for a page from the same domain are made, how are you going[/color][/color]
        to[color=blue][color=green]
        > > determine the end of the Session? The browser doesn't inform the server[/color]
        > that[color=green]
        > > it's navigating away or closing. HTTP is stateless.
        > >
        > > What you need to do is USE Session, but use it wisely. Make sure your[/color][/color]
        app[color=blue][color=green]
        > > includes code to handle what happens if the Session is lost due to
        > > inactivity and a new Session is started.
        > >
        > > --
        > > HTH,
        > >
        > > Kevin Spencer
        > > Microsoft MVP
        > > .Net Developer
        > > http://www.takempis.com
        > > Neither a follower nor a lender be.
        > >
        > > "J" <nospam> wrote in message[/color][/color]
        news:eZvTq7WZDH A.628@TK2MSFTNG P10.phx.gbl...[color=blue][color=green][color=darkred]
        > > > What is the correct method to use if I want to store a variable within[/color][/color]
        > my[color=green][color=darkred]
        > > > web application, that is available to every single page within the
        > > > application, but is lost when the user navigates to a page outside of[/color][/color]
        > the[color=green][color=darkred]
        > > > app.
        > > >
        > > > I don't want to use session variables because they only last a short[/color]
        > > period[color=darkred]
        > > > of time (and I'm NOT allowed to increase the session variable time on[/color][/color]
        > the[color=green][color=darkred]
        > > > web-server).
        > > >
        > > > TIA
        > > >
        > > >
        > > >
        > > >[/color]
        > >
        > >[/color]
        >
        >[/color]


        Comment

        • Kevin Spencer

          #5
          Re: Global Variables

          What exactly do you want to know?

          --
          HTH,

          Kevin Spencer
          Microsoft MVP
          ..Net Developer
          All hotels in Benidorm. The best selection of Benidorm hotels with reviews and maps. Book in advance and save.

          Neither a follower nor a lender be.

          "James Zhuo" <nano_electroni cs@optusnet.com .au> wrote in message
          news:Oe%23Fl2YZ DHA.1644@TK2MSF TNGP10.phx.gbl. ..[color=blue]
          > Agree, but as to how that is done i am clueless.
          > But what you describe certainly sounds like Session variable is the most
          > logical of all
          > Application variable is not so appropriate since it sounded like you[/color]
          wanted[color=blue]
          > the variable
          > to be user particular
          >
          > Cheers
          >
          > J
          >
          > "Kevin Spencer" <kevin@takempis .com> wrote in message
          > news:e2MJCvYZDH A.1832@TK2MSFTN GP10.phx.gbl...[color=green]
          > > You're SOL. How is the variable supposed to be lost when the user[/color][/color]
          Session[color=blue][color=green]
          > > ends? For example, let's say that you use a Cookie instead, and don't[/color][/color]
          set[color=blue]
          > an[color=green]
          > > expiration. What you've done is the equivalent of a client-side Session
          > > variable. When the Session ends, the Cookie will be destroyed. When does[/color]
          > the[color=green]
          > > Session end? When there are no requests for a new page from the same[/color]
          > domain[color=green]
          > > within a certain time period. If you don't use an object that times out[/color]
          > when[color=green]
          > > no requests for a page from the same domain are made, how are you going[/color][/color]
          to[color=blue][color=green]
          > > determine the end of the Session? The browser doesn't inform the server[/color]
          > that[color=green]
          > > it's navigating away or closing. HTTP is stateless.
          > >
          > > What you need to do is USE Session, but use it wisely. Make sure your[/color][/color]
          app[color=blue][color=green]
          > > includes code to handle what happens if the Session is lost due to
          > > inactivity and a new Session is started.
          > >
          > > --
          > > HTH,
          > >
          > > Kevin Spencer
          > > Microsoft MVP
          > > .Net Developer
          > > http://www.takempis.com
          > > Neither a follower nor a lender be.
          > >
          > > "J" <nospam> wrote in message[/color][/color]
          news:eZvTq7WZDH A.628@TK2MSFTNG P10.phx.gbl...[color=blue][color=green][color=darkred]
          > > > What is the correct method to use if I want to store a variable within[/color][/color]
          > my[color=green][color=darkred]
          > > > web application, that is available to every single page within the
          > > > application, but is lost when the user navigates to a page outside of[/color][/color]
          > the[color=green][color=darkred]
          > > > app.
          > > >
          > > > I don't want to use session variables because they only last a short[/color]
          > > period[color=darkred]
          > > > of time (and I'm NOT allowed to increase the session variable time on[/color][/color]
          > the[color=green][color=darkred]
          > > > web-server).
          > > >
          > > > TIA
          > > >
          > > >
          > > >
          > > >[/color]
          > >
          > >[/color]
          >
          >[/color]


          Comment

          • Alvin Bruney

            #6
            Re: Global Variables

            why are you not allowed to tamper with session on the webserver?
            what's the point of cruisecontrol on a car if you aren't allowed to use it?
            seems like you need to go talk to whoever made that rule and ask them to
            answer this question cuz i can see no good reason for that limitation.

            "James Zhuo" <nano_electroni cs@optusnet.com .au> wrote in message
            news:Oe#Fl2YZDH A.1644@TK2MSFTN GP10.phx.gbl...[color=blue]
            > Agree, but as to how that is done i am clueless.
            > But what you describe certainly sounds like Session variable is the most
            > logical of all
            > Application variable is not so appropriate since it sounded like you[/color]
            wanted[color=blue]
            > the variable
            > to be user particular
            >
            > Cheers
            >
            > J
            >
            > "Kevin Spencer" <kevin@takempis .com> wrote in message
            > news:e2MJCvYZDH A.1832@TK2MSFTN GP10.phx.gbl...[color=green]
            > > You're SOL. How is the variable supposed to be lost when the user[/color][/color]
            Session[color=blue][color=green]
            > > ends? For example, let's say that you use a Cookie instead, and don't[/color][/color]
            set[color=blue]
            > an[color=green]
            > > expiration. What you've done is the equivalent of a client-side Session
            > > variable. When the Session ends, the Cookie will be destroyed. When does[/color]
            > the[color=green]
            > > Session end? When there are no requests for a new page from the same[/color]
            > domain[color=green]
            > > within a certain time period. If you don't use an object that times out[/color]
            > when[color=green]
            > > no requests for a page from the same domain are made, how are you going[/color][/color]
            to[color=blue][color=green]
            > > determine the end of the Session? The browser doesn't inform the server[/color]
            > that[color=green]
            > > it's navigating away or closing. HTTP is stateless.
            > >
            > > What you need to do is USE Session, but use it wisely. Make sure your[/color][/color]
            app[color=blue][color=green]
            > > includes code to handle what happens if the Session is lost due to
            > > inactivity and a new Session is started.
            > >
            > > --
            > > HTH,
            > >
            > > Kevin Spencer
            > > Microsoft MVP
            > > .Net Developer
            > > http://www.takempis.com
            > > Neither a follower nor a lender be.
            > >
            > > "J" <nospam> wrote in message[/color][/color]
            news:eZvTq7WZDH A.628@TK2MSFTNG P10.phx.gbl...[color=blue][color=green][color=darkred]
            > > > What is the correct method to use if I want to store a variable within[/color][/color]
            > my[color=green][color=darkred]
            > > > web application, that is available to every single page within the
            > > > application, but is lost when the user navigates to a page outside of[/color][/color]
            > the[color=green][color=darkred]
            > > > app.
            > > >
            > > > I don't want to use session variables because they only last a short[/color]
            > > period[color=darkred]
            > > > of time (and I'm NOT allowed to increase the session variable time on[/color][/color]
            > the[color=green][color=darkred]
            > > > web-server).
            > > >
            > > > TIA
            > > >
            > > >
            > > >
            > > >[/color]
            > >
            > >[/color]
            >
            >[/color]


            Comment

            • Alvin Bruney

              #7
              Re: Global Variables

              why are you not allowed to tamper with session on the webserver?
              what's the point of cruisecontrol on a car if you aren't allowed to use it?
              seems like you need to go talk to whoever made that rule and ask them to
              answer this question cuz i can see no good reason for that limitation.

              "James Zhuo" <nano_electroni cs@optusnet.com .au> wrote in message
              news:Oe#Fl2YZDH A.1644@TK2MSFTN GP10.phx.gbl...[color=blue]
              > Agree, but as to how that is done i am clueless.
              > But what you describe certainly sounds like Session variable is the most
              > logical of all
              > Application variable is not so appropriate since it sounded like you[/color]
              wanted[color=blue]
              > the variable
              > to be user particular
              >
              > Cheers
              >
              > J
              >
              > "Kevin Spencer" <kevin@takempis .com> wrote in message
              > news:e2MJCvYZDH A.1832@TK2MSFTN GP10.phx.gbl...[color=green]
              > > You're SOL. How is the variable supposed to be lost when the user[/color][/color]
              Session[color=blue][color=green]
              > > ends? For example, let's say that you use a Cookie instead, and don't[/color][/color]
              set[color=blue]
              > an[color=green]
              > > expiration. What you've done is the equivalent of a client-side Session
              > > variable. When the Session ends, the Cookie will be destroyed. When does[/color]
              > the[color=green]
              > > Session end? When there are no requests for a new page from the same[/color]
              > domain[color=green]
              > > within a certain time period. If you don't use an object that times out[/color]
              > when[color=green]
              > > no requests for a page from the same domain are made, how are you going[/color][/color]
              to[color=blue][color=green]
              > > determine the end of the Session? The browser doesn't inform the server[/color]
              > that[color=green]
              > > it's navigating away or closing. HTTP is stateless.
              > >
              > > What you need to do is USE Session, but use it wisely. Make sure your[/color][/color]
              app[color=blue][color=green]
              > > includes code to handle what happens if the Session is lost due to
              > > inactivity and a new Session is started.
              > >
              > > --
              > > HTH,
              > >
              > > Kevin Spencer
              > > Microsoft MVP
              > > .Net Developer
              > > http://www.takempis.com
              > > Neither a follower nor a lender be.
              > >
              > > "J" <nospam> wrote in message[/color][/color]
              news:eZvTq7WZDH A.628@TK2MSFTNG P10.phx.gbl...[color=blue][color=green][color=darkred]
              > > > What is the correct method to use if I want to store a variable within[/color][/color]
              > my[color=green][color=darkred]
              > > > web application, that is available to every single page within the
              > > > application, but is lost when the user navigates to a page outside of[/color][/color]
              > the[color=green][color=darkred]
              > > > app.
              > > >
              > > > I don't want to use session variables because they only last a short[/color]
              > > period[color=darkred]
              > > > of time (and I'm NOT allowed to increase the session variable time on[/color][/color]
              > the[color=green][color=darkred]
              > > > web-server).
              > > >
              > > > TIA
              > > >
              > > >
              > > >
              > > >[/color]
              > >
              > >[/color]
              >
              >[/color]


              Comment

              Working...