General discussion
Thread display: Collapse - |
All Comments
Start or search
Create a new discussion
If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.
ASP.NET Equivalent of Server-Side Includes?
In the part of the website where users have logged in, we are storing a very few pieces of data in session variables, then referencing them as needed on each page. Each page includes an INC file that contains code to check a particular session variable, and if it's not populated because the user hasn't logged in or his session has expired, direct him to the appropriate "session expired" notice page. If it is populated, a series of other variables (Dim'd in the INC file and referenced later in each page) are populated according to the contents of another session variable.
How do I accomplish the same thing in ASP.NET? I could put this into a custom code snippet, but while that's nice for when I first create a new page, it's taking one step backwards as far as code reuse and ease of maintenance goes.
Or, I could rework this as a class and make those INC variable as properties of the class, but classes can't directly access session variables, meaning I can't populate the properties in the New constructor. So I'd have to duplicate code in each page that uses the class to populate those properties in the Page_Load sub, and now I've got a different set of ease-of-maintenance issues.
There has to be another way to do this in .NET. Isn't there?