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.
 
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
 
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.
 
Back
Top