Most web sites out there have the same things or a common denominator on
every page of their web application. Examples: A banner at the top,
navigation links off to the left. Some links or other advertisements off to
the right. Web programmers want these things on every page.
Then they want custom content, or content that is different on every page in
the middle (usually in the middle or the main part of the page), for
example, the stuff that is not a common denominator from page to page.
When designing a web application, you want to centralize things that are
common denominators, such as what you always want to appear at the top,
sides, and the bottom of each page. In the past, I've heard of web
developers putting all these things in some type of include files.
Question #1: Is using include files the best way to implement code that you
want to be common all your pages? If not, what is?
I've heard of developers holding this type of code in a database or in XML
files. Which is best? I would think if you put this code in a database or in
an XML file, you would lose all the helpful editing functionality of the
VS.NET editor, such as intilisense and color coding.
Let's says using include files is the best way to do this. What about code
behind files? Now with ASP.NET, don't you want all your code
(non-presentation, logic code) in a code behind file? Also, can you do
dynamic includes in the code behind file? Aren't you limited to doing
response.write?
I'm sure there are more considerations I haven't listed here, I just can't
think of any more.
Question #2: What is the best way to dynamically display content in the
middle (the stuff that is different from page to page) of a web page? I
guess you would call this content management. Do you store this stuff in a
database? An XML file? Or put it directly into a separate aspx file. with
all the includes for the stuff at the top, sides, and bottom? I would think
there would be a better way than this.
Of course this content would need to be able to have tags and all inside.
Maybe even asp.net server controls (is this possible when code is brought in
from a database or xml file?).
Obviously there's a difference between using include files (that can also be
aspx files) and content brought in or wrote out with response.write in a
code-behind code module.