Best place for global data?

bulldogniner

New member
Joined
Jun 14, 2006
Messages
3
Programming Experience
Beginner
I am new to vb.net and need to understand where to put my functions so that they can be accessed by multiple pages. I am developing an asp.net application using vb codebehind.

My application is using masterpages. On the masterpage is a navigation section that needs to be manipulated based on user permissions. I have an xml files that stores the user permissions. Currently, I am parsing the xml file and storing the results in local variable in the masterpage.vb file. I will need to check these permissions on each page. I was thinking that I should put these in some sort of global or session variable so that all my pages can access them.

What is the best solution?

Thanks.
 

wizzardmr42

Well-known member
Joined
Mar 15, 2008
Messages
90
Location
England
Programming Experience
10+
You can put them into a page variable or make a function in a class in App_Code that will read the data and return the appropriate result
 

kulrom

Well-known member
Joined
May 10, 2005
Messages
2,854
Location
Republic of Macedonia
Programming Experience
10+
If the NavBar is on the Master Page then you don't need to check the permissions again and again. Do that once at the Master page code and it will apply the logic across the all content pages.

Btw, as wizzardmr42 suggested you may add your code in the App_Code folder which is reserved exactly for this situations.
 
Top Bottom