Web Application architecture preference – level 300

I’d like to share my preference in building web applications.  First, I’d like to remember that in ASP 3.0, every page posted information to another page, so every page had to know the URL to the next page.  This created spaghetti-posting, and the web application became very brittle because if a page moved, other pages declaratively linking or posting to it were broken.  Those who implemented large web applications with ASP 3.0 know exactly what I’m talking about.

With ASP.NET the potential for that problem still exists, but some simple design decisions can save  you maintainence time down the road.  Specifically, I’m talking about putting all visible elements and logic in user controls.  I, personally, don’t implement any UI in my .aspx files.  All my .aspx files are there for is to hook up .ascx files.  This makes for no URL binding, and my control flow is all programmatic.  All my screens are different user controls, and a master user control decides which controls to load for a particular screen.

VS has some really great RAD features that make slogging out code very easy, and you will have a working application very quickly, but your maintainability will suffer.  Since I’ve been using my user control method, my apps have been extremely easy to maintain even in the face of changing requirements and design change requests.  Give it a try.

In ASP.NET 2.0, imagine have a .aspx that sets the master page, sets the thems, and then loads a user control.  In this way, your site is VERY flexible.  Your custom screen (user control) could be moved to any page anywhere in the site as well as adapted to different looks by changing the master page and theme.