By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,508 Members | 1,823 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,508 IT Pros & Developers. It's quick & easy.

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

100+
P: 134
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
Nov 13 '11 #1

✓ answered by Sl1ver

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

Then all you do is bool myBool = ConfigurationManager.AppSettings["your key name"].ToString();

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

Share this Question
Share on Google+
5 Replies


Sl1ver
100+
P: 196
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?
Nov 15 '11 #2

100+
P: 134
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.
Nov 15 '11 #3

Sl1ver
100+
P: 196
Go into Web.Config, read an article on how to add a new key to appsettings

Then all you do is bool myBool = ConfigurationManager.AppSettings["your key name"].ToString();

or else store it in a session variable, that way you will always be able to use it.
Nov 15 '11 #4

100+
P: 134
oke thanks a lot Sl1ver
Nov 15 '11 #5

Expert 100+
P: 750
PRR
Hi Michaeldebruin,
I would suggest ASP.NET State management Overview

Join Bytes
Nov 22 '11 #6

Post your reply

Sign in to post your reply or Sign up for a free account.