Are ASP.net Content Web Forms able to access variables declared in the Code Behind section of it's Master Page? -


i have master page controls styling of site. in code behind, there few class instances instantiated variables. these classes validate user access , create user objects

i have few web content forms carries out instructions based on user objects. far seems on each web content form have create new instances of classes found on master page. doubling work every web content form.

is there anyway can inhereit classes , objects instantiated in master page code behind?

expose objects (and controls) public properties (get controls) on master page. then, in each aspx page want access these objects, add following declaration @ top:

<%@ mastertype virtualpath="~/mymasterpage.master" %> 

as @kristof points out, access properties master.propertyname

also, can determine if makes sense store objects in users session (don't forget must serializable if use db session state). , control access them via properties in base page class pages inherit from. actually, have base master, page, , usercontrol have access same properties (for me it's currentuser) everywhere.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -