Question ASP UserControl and user security

keb1965

Well-known member
Joined
Feb 9, 2009
Messages
103
Programming Experience
10+
I am not exactly sure how to frame this question, but here goes ...

I have a webpage (default.aspx) that uses nine custom controls (xxx.ascx). Each of these custom controls represent a different class that interact independently from one another. (Imagine a multiple document desktop application that can open nine different types of files). What I need to do is create a point of security within default.aspx that I can also use within these other nine classes (as well as a few other globals that I can use in my UserControls.

I am thinking that I could do a few things, but I am not sure of the ramifications of doing so or which might be better.

1) Import the App.default class into the several user controls and make the default class globals Protected Friend Shared (breaks the encapsulation ideology);
OR
2) Create ReadOnly properties in the default class and access them when the usercontrol is created (is there a timing issue?);
OR
3) Create properties in the UserControls and set them from the default class.

I am actually leaning toward #3 as it seems to be the simplest and most straightforward way to handle the situation, however, I need to initialize the user within the control prior to rendering it and I can see problems arising if the page tries to render prior to the user being initialized. If this were one class, I would simply initialize on Page_Load and be done with it.

Suggestions?
 
Back
Top