how to get a value of a variable from another page?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • michaeldebruin
    New Member
    • Feb 2011
    • 134

    how to get a value of a variable from another page?

    Hello all,

    I've made a variable in my masterpage but is here anyone who knows how I can get the value of it when being on a webpage?
    I know the masterpage is the general page. But when loading it I am creating a new bool variable, but I want to be able to get the value of it and changing to value of it when being on for example the default page. Anyone any ideas?

    Thnx in advance
  • Sl1ver
    New Member
    • Mar 2009
    • 196

    #2
    What exactly do you want to do, do you want to be on the page, click something and go back to default with the value?

    Comment

    • michaeldebruin
      New Member
      • Feb 2011
      • 134

      #3
      Yeah srry my description is a little bit confusing. What I want is a variable stored somewhere and I want to be able to get the variable on every webpage. For example if I start my website as soon as the default webpage comes up. I must have created a boolean variable and when I click on a button which links me to another webpage, that webpage must be able to get the variable and it's value. The boolean variable must work just like a session when logged in.
      So that means that when I log in, I must be able to change the value of the bool.
      With C# I already did something like this but then I just stored the variable in a settings file, on that way it was possible to get the value of the variable anywhere I want. So if you have any ideas how to do this with a ASPX website I would like to hear that.

      I know there are better ways to do something like this and also safer ways but the website is not going online anyway, it is just for a school project.

      Comment

      • Sl1ver
        New Member
        • Mar 2009
        • 196

        #4
        Go into Web.Config, read an article on how to add a new key to appsettings

        Then all you do is bool myBool = ConfigurationMa nager.AppSettin gs["your key name"].ToString();

        or else store it in a session variable, that way you will always be able to use it.

        Comment

        • michaeldebruin
          New Member
          • Feb 2011
          • 134

          #5
          oke thanks a lot Sl1ver

          Comment

          • PRR
            Recognized Expert Contributor
            • Dec 2007
            • 750

            #6
            Hi Michaeldebruin,
            I would suggest ASP.NET State management Overview

            Join Bytes

            Comment

            Working...