Structure of my ASP.NET Web Applications
I’ve had some requests recently to describe how I structure my ASP.NET web applications. To be clear, this is not the only way to structure your application. It is MY way. It works for me and it works for all of my clients. If you don’t already have something that’s working for you, it will probably work well for you as well.
ASPX and ASCX files
First, let’s assume that our site is rather flat. That is, all of our ASPX files are at the root of the application. Not that this is always true, but it will allow us to cover the general cases first. Toward the end of this post, I’ll describe how I handle sites with subdirectories in them.
All of my web user controls go in a /controls directory.
Site Images
As a general rule, I put all of my site specific images in /images. These are images that the application will use to display page-specific information and should not be confused with images we will use for general site look and feel.
JavaScript files
All of my JavaScript files go in a /js directory by convention. If the files have something to do with an ASPX file, I’ll name it the same as the ASPX file. If it is specifically tied to a web user control, I’ll put it in a /js/controls directory with the same name as the control. Any JavaScript that happens to be common to multiple pages of my site, I’ll place in a /js/common directory. This includes JavaScript that is associated with the master page of the site.
Theme Structure
The structure of my individual theme directories is similar. All the CSS files go in the base directory, images in the theme’s images directory. If I have CSS that is specific to a particular page, I’ll create a separate CSS file and give it the same name as the page it controls.
Sites with Subdirectories
With larger sites, it is sometimes valuable to put your ASPX files in subdirectories to keep things even more organized. If I do that, then I create corresponding subdirectories in my JavaScript, controls, and images directories as it makes sense.
Other Related Items:
Pro ASP.NET MVC 2 Framework, Second Edition (Expert's Voice in .NET)Author Steven Sanderson has seen the ASP.NET MVC Framework mature from the start, so his experience, combined with comprehensive coverage of all th... Read More >
Nikon ML-L3 Wireless Remote Control for Nikon D40, D40x, D60, D80 & D90 Digital SLR CamerasMODEL- 4730 VENDOR- NIKON INC
FEATURES- ML-L3 Remote Control Transmitter
Trigger the shutter remotely when usi... Read More >
Syma S012 Apache AH-64 Mini 3-Channel Infrared RC Helicopter ---NEW!Amazing Technology in the palm of your hand!!! This Brand New 3 Channel mini rc helicopter is 1 of the world's newest, smallest and lightest RC Helico... Read More >










[...] Structure of my ASP.NET Web Applications (Dave M. Bush) [...]