473,396 Members | 1,813 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Best Use of Master Pages - dynamic content and event handling

I'm creating an application that has a standard layout for all pages.
The information that is displayed in the layout will be dynamic based
on the user that is logged in. Thus when a page is browsed to, I need
to check to see if the user has logged in or not. Then if they have
logged in, I need to pull their information from the database to
display in the header.

In previous applications, I made use of a base web page that all the
content pages inherited from to check whether they were logged in and
to create a database connection. With VS 2005, I thought I'd try to
make use of the Master Page to incorporate the standard layout. But I'm
not sure of the best way to do this with the base web page
functionality and the master page combined. Do I query the database for
the user information from the Master page or the base web page class?
Also as I click on different buttons in the layout, different
information is displayed - should the Master page handle that click
event - if so, how do I get the content page to refresh according to
what they have clicked?

Also would the best route for the user information to be to collect it
the first time a user logs in and then store it in session variables so
I don't have to query the database for the user information every time?
The impression has always been that session variables are bad so I've
avoided them but are they safe with 2005 now (across multiple servers
as well).

Sorry for all the questions but I just want to make sure I'm using the
Master Page functionality in the recommended way. I've read a number of
articles from MSDN and other sites but haven't found any solid ideas
surrounding my particular implementation.

I appreciate all suggestions!

Apr 30 '06 #1
1 2927
On 29 Apr 2006 17:12:56 -0700, "LilC" <ca*********@hotmail.com> wrote:
I'm creating an application that has a standard layout for all pages.
The information that is displayed in the layout will be dynamic based
on the user that is logged in. Thus when a page is browsed to, I need
to check to see if the user has logged in or not. Then if they have
logged in, I need to pull their information from the database to
display in the header.

In previous applications, I made use of a base web page that all the
content pages inherited from to check whether they were logged in and
to create a database connection. With VS 2005, I thought I'd try to
make use of the Master Page to incorporate the standard layout. But I'm
not sure of the best way to do this with the base web page
functionality and the master page combined. Do I query the database for
the user information from the Master page or the base web page class?
Also as I click on different buttons in the layout, different
information is displayed - should the Master page handle that click
event - if so, how do I get the content page to refresh according to
what they have clicked?

Also would the best route for the user information to be to collect it
the first time a user logs in and then store it in session variables so
I don't have to query the database for the user information every time?
The impression has always been that session variables are bad so I've
avoided them but are they safe with 2005 now (across multiple servers
as well).

Sorry for all the questions but I just want to make sure I'm using the
Master Page functionality in the recommended way. I've read a number of
articles from MSDN and other sites but haven't found any solid ideas
surrounding my particular implementation.

I appreciate all suggestions!


Think of it this way...

The reason for using the masterpage is to do all the things you repeat on all of
the pages on the masterpage, so anything you are doing to all of the pages can
go on the masterpage. Yes, you can pull the data for the master page from the
database. You may even find that you don't have to do it but one time per
session. Think of the master page as a frame, but understand that it is not ;o)

Session variables have always been OK, but you must be aware that if your web
site is hosted in a web farm there will be problems, unless the web farm is
setup with a state server. This is not a problem, but you will need to reset
some switches in your web.config file if the site is on a farm. Your site admin
can help you with that.

Good luck with your project,

Otis Mukinfus
http://www.arltex.com
http://www.tomchilders.com
Apr 30 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: pmelies | last post by:
One of our web servers is not handling requests for ASP.net pages. We get a "A dynamic link library (DLL) initialization routine failed." error message, though nothing is recorded in the event...
7
by: Martijn Saly | last post by:
Hi there, I've created a master page with some controls on it, a Calendar control among others. Now depending on the date(s) selected, the content page needs to be updated. In the masterpage...
5
by: Federico | last post by:
I have a problem, I have an event declared in a Master Page, and I want to use in a Content Page holder of a Content Page. When I want to create the method to handle the event, I can njot reference...
17
by: Rob R. Ainscough | last post by:
Again another simple concept that appears NOT to be intuitive or I'm just stupid. I've read the WROX book and the example doesn't actually show how the .master page links in the other content...
11
by: EagleRed | last post by:
I am writing an ASP.NET 2.0 application that uses master pages. I have some pages that must not be cached on the client. In ASP.NET 1.1 I achieved this using metatags: <meta...
9
by: Victor Rodriguez | last post by:
Is there a way to present just the content of a page and turn off the master page by code? thanks, Victor
13
by: Kirk | last post by:
I have been reading Scott Allen's article on Master Pages (http:// odetocode.com/Articles/450.aspx) but I am having problems understanding a concept. Specifically, I have created a property...
1
by: dixonjm | last post by:
Hi, I am trying to develop an error handling in our asp.net web app. I'm pretty new to Master pages although the concept of master pages had been completed by someone else & works fine. What I...
6
by: =?Utf-8?B?SmF5IFBvbmR5?= | last post by:
I am trying to access a Public property on a Master Page from a Base Page. On the content pages I have the MasterType Directive set up as follows: <%@ MasterType virtualpath="~/Master.master" %>...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.