Cool Dude Programmer I have just begun working on an application, a website which offers people paid subscriptions via PayPal to a weekly message, which they can view on the site after logging in. I had the site designed, including the CSS and two separate master pages. The site was up on staging as an ASP.NET 2.0 Web Application Project written in C#, and I had just started looking to the required functionality when I got an unexpected lesson in the differences between the two ASP.NET development models; that is, the "Web Site" and the "Web Application Project" models.

Quick note on naming conventions: I always use the single-word version, "website"; personal choice. Microsoft refers to the ASP.NET template as "Web Site", as in FILE -> New Web Site. Still, if you look at the Drop Down Menu names in Visual Studio after opting to go with a "Web Site", you will see "Website". Worse still, try googling this! Consistency aside, this is one dumb-ass naming choice which is right up there with MOSS "Features", another joy to Google... end of rant ;-)

I normally use the Web Application Project model because it is what I am used to and it makes sense to me. I have always viewed the Web Site model as something to use for demonstration purposes and the like. Truthfully, when Microsoft initially brought out only the Web Site template with VS 2005 and then did the turnaround to also include the Web Application Project template in SP1, I believe that at this point they should have dropped the Web Site model completely. To this day, it leads to nothing but confusion among developers of all levels.

The differences between the two models have been pretty well covered, or at least so I thought. This article is not going to delve into the details of these templates, so for the benefit of those new to ASP.NET, here are some informative references on the two models:

* Comparing Web Site Projects and Web Application Projects
* Visual Studio 2005 Web Application Project Option
* ASP.NET 2.0 - Web Site vs Web Application
* Converting a Web Site Project to a Web Application Project
* Add a Reference to a Visual Studio Project in a Web Site

 With a two-week deadline, I wanted as much out-of-the-box functionality as I could leverage from ASP.NET.

Surprise #1: Profiles only Work Out-of-the-Box with the Web Site Template
In order to implement the logic for the application described above, I planned on using User Profiles to store some extra information for each subscriber such as the date they subscribed along with the type of subscription. Profiles allow you to store some extra information per user when using the ASP.NET membership system. In this case, I was using SQL Server 2005 to store membership details. Profiles are stored in the database automatically and all we have to do is add this extra information to our web.config file. We don't need to know anything about how this data is stored or retrieved.

What they don't tell you is that Profiles only work out-of-the-box with the Web Site option. I discovered this while reading the comments on Scott Guthrie's great blog posting on this topic. There is a workaround available and you can find out more about that here. The problem stems from the fact the Web Application Project does not have the Profile object automatically added to each page as with the Web Site project, so we cannot get strongly-typed programmatic access to the profile properties defined in our web.config file.

The Web Project workaround did not appeal to me because this is an E-Commerce site for a client and I did not like the idea of having to resort to an add-in. I had no way of knowing how stable this was or what other issues might have arisen within my short project time-frame. You can code your own custom profile class if you choose.

The real kicker here is that Profiles are still not available out-of-the-box with the VS 2008 ASP.NET 3.5 Web Application Project template. A mysterious omission...

Surprise #2: Where is the Web Content Form in the Web Site Project?
As already mentioned, I was using two separate master pages and every page in my site is based off one of these master pages. When I went to add a Web Content Form in the Web Site "project", there was none! At first I hand-coded the page tag, then I noticed the "Select master page" checkbox. The images below show the Web Content Form when using a Web Application Project and the lack of one when using the Web Site "Project".

Web Application Project - Web Content Form


Web Site Project - No Web Content Form


Surprise #3: Where have all the Namespaces Gone?
No namespaces are used for classes anywhere in the App_Code folder. Now, most of us already know that the application automagically finds classes placed in this folder. But, for someone like me who is so used to working with the project model, this didn't strike me right off the bat! So, presumably name conflicts are not a cause for concern here? This is confirmation that Microsoft never intended the Web Site "Project" template for enterprise work, if anyone was ever in any doubt.

My own project will have a user control which is referenced from a master page. On reading this post by Rick Strahl, I see that there are all kinds of difficulties when accessing user controls with the Web Site model - read through the comments. Now I'm thinking that I may revert to the Web Application Project and use the Web Profile Builder to solve my Profile issues after all! At least I won't have grapple with trying to dynamically load a user control from a different assembly... are you getting the bad code smell yet?

Comments (29) -

Scott United States
6/21/2008 2:03:59 PM #

Thanks for the blog.  I was hoping the issues with "Web Site" was fixed in VS 2008.  I'll just have to continue with "Web Application" projects.

Daniel France
7/18/2008 4:24:06 AM #

Thank you for your article.
It explains some troubles I got with my web site project.
I thought the problem was in my understanding of how VS2008 works.

Henry Colombia
7/20/2008 5:37:14 PM #

Excelent article, thanks a lot.

David Grant
David Grant United States
8/2/2008 3:52:27 AM #

Good article.

Perry Xu
Perry Xu People's Republic of China
9/18/2008 7:07:11 PM #

Great article!

Vijay United States
10/1/2008 9:00:05 AM #

Just what i was looking for! Great article, thanks for posting this. Microsoft is foolishly famous for confusing/messing things up & the documentation sucks big time. No where could i find an easier explanation to the 2.0 compilation model, debug and release builds. Microsoft seriously needs innovators not software laborers.

John Jiang
John Jiang United States
10/16/2008 8:04:56 AM #

Thanks for clearify some very confusing issues. That why even some long time Microsoft developers hate it's product.

Steve United Kingdom
11/6/2008 7:52:38 AM #

Useful, knowedgeable and appreciated. A good insight. Thanks

Stormy United States
11/7/2008 11:05:42 PM #

Thanks for the great article!

I would add, that a very simple explanation of "Web Sites" versus "Web Applications" in ASP.NET 2.0+ is websites compile dynamically and create assemblies on-the-fly, while web applications use the old 1.1 and VS 2003 model and compile everything into one giant assembly (like desktop apps).

I personally will never ever use the Web Application model as the compile model to me breaks with the traditional interpreted language web model of development/changes on the fly and the need to update web pages and code quickly. The whole thought of having to go back to a heavy OOP, giant assembly-based class system for web development is antiquated and tied to a dying desktop application model that is dying a slow death.

Using "Websites" and the "Web Site" model is the only way to go. If you cant figure out how to use App_Code namespaces and include references to user controls in "Web Sites" in ASP.NET, then you need to go get some training. Its not hard. I just wouldnt sacrifice the great dynamic features of Web Sites for the clunky development aspects of Web Applications.

agrace United States
11/7/2008 11:50:21 PM #

Hi Stormy,

The Web Site model does not lend itself to enterprise projects and I don't personally like the idea of no namespaces. We have custom build tools and the command line though to do pretty much whatever we want. You need to go back to when VS 2005 first appeared in its pre-SP1 incantation to try and get in the mindset of the VS team at the time and where they thought we were going vis-a-vis the "drag and drop brigade". That they did 180 degree turn so fast with SP1 and re-introduced the Web Application Project model speaks volumes.

Thanks for the feedback Stormy and I reckon some of this will always come down to personal preferences and whichever model we are most used to...

Anthony Smile

Kyle United States
11/9/2008 12:58:48 AM #

Great article here.  A comment about Web apps being unable to use the ASP.NET profile provider.

The "profile provider model" uses metadata in your web.config file to "strong type" your profile object with the custom fields you want to use.

Obviously this requires a LOT of dynamism in the compilation process, so that the compiler doesn't get hung up on you, using properties of the DefaultProfile class that aren't defined.

This requires the liberal "preprocessing" done in Web sites, but doesn't lend itself to the "strict constructionist" compilation behavior found in a web application.

I agree with you, web sites are BAD for enterprise apps. I've seen waaay too many web "applications" with real and complex business realm logic in them written as an unmaintainable steaming pile of spagetti code using the "site" model, a model that facilitates terrible programming practices.

Jack United States
3/12/2009 10:32:49 PM #

You guys ate nuts!  We use Web Sites over applications in our enterprise environment.  The only time we don't is when we have to support applications written using the web application model (management won't approve a rewrite).  Those are a royal pain to deploy changes to as compared to the Web site model apps.  Kyle, as a consultant, I can easily find at least one  poorly written Web application done in the application model for every one you can find written as a Web site.  Don't blame poor coding practices on the architecture.  
Microsoft did a 180 because of all the desktop developers whining because they were too lazy to learn a newer and better way to do things.  Looks like that hasn't changed.  

non Thailand
3/21/2009 6:19:46 PM #

They are pros and cons for each type of project.

But frankly, I still prefer Web Application Project.

Thank you for your great article.

Arik Porat
Arik Porat Israel
4/12/2009 8:39:14 AM #

Thank you very much, Anthony, for this useful, well-written post.

Stacy United States
4/15/2009 3:50:19 AM #

I felt the pain of the Website model with deployment. All files used in compilation have new creation dates and my ftp would deploy files even if the file had no other changes. Impossible to repeat a build from source. I use the profile object heavily and could not make a conversion to web app model work. So stayed with website model.

For deployment, I use the web deployment project and finalbuilder. I zip up all files and deploy one file. Unzip on the server, change the virtual directory in iis to the unzipped folder. Works well. Quick deploy and instant rollback if neccessary (previous virtual directory left on server). Working on getting it all done with one click on my laptop.

Robert Werner
Robert Werner Canada
4/23/2009 11:39:37 PM #


I have purchased VS2008 but not yet installed it.  Have you?  If so, could you tell me what type of project you would create in VS2008, if there even is a choice?

I want to get moving forward in the best way possible!

Thank you,

Robert Werner
Vancouver, BC

agrace United States
4/24/2009 8:51:20 AM #


You can pretty much code anything... the IDE is not restrictive in that sense. The .NET libraries is where the power lies. If you are doing Web work, I would favor the Web Project template.

Anthony Smile

Angela United States
7/22/2009 10:52:11 AM #

We were on the WAP major problem is deploying chunks of the website software at different times.  WAP doesn't lend it self to sharing usercontrols and masterpages very well

The project files are a pain and I could not find documentation on them

the designer files are constantly getting corrupted.

And one lazy whine is if I wanted to be a desktop developer I would.  I like to be able to change my codebhind file and hit f5  and have it only compile that page and not the zillion of all other pages in my application.

I just converted architecturely to website and left website application projects.

We too use web deploymnet project which still allows us to do DLLS... but atleast now we can deploy parts of the site via DLLs into Virtual directores and still have it share common user controls and master pages easily(thanks to the power of perforce source code control software)

Without requiring all other parts of the website to be regressioned tested every single time a usercontrol or master page or skin files gets changed or added.  We can now do it in chunks.

Yeah! I just completed and look forward to my first release.

Marc Ecko
Marc Ecko United States
7/23/2009 2:54:42 AM #

Please let me know if you are interested to work as article writer for me? I can offer $10/article.

agrace United States
7/30/2009 2:24:42 PM #

$10? I could probably get a pack of ciggies for that except that by the time I'd complete the article I'd have them smoked Surprised

tapan India
8/28/2009 9:06:55 AM #

i have created a web site in which login facility is there...
but how can we provide a logout....i know for that we have to clear a cookies ....

but i don know how to do it.......

i am doing in this in

plz rpl on this email as soon as possible......

mayuri patil
mayuri patil United States
9/9/2009 7:18:30 AM #

thank U.

Priya India
10/13/2011 1:48:52 AM #

Excellent article. thanks alot.

nilesh India
12/13/2011 2:14:04 AM #

Thanks For post.

ASP.NET Development
ASP.NET Development United States
12/21/2011 3:39:50 AM #

What a great write up!!!
Thanks a lot for sharing. It's really very useful.

Irshad Malaysia
1/12/2012 1:41:35 AM #

thanks a lot for the great article.i was creating a website and wanted to create a installer class under app_code.but i couldnt find it.thats how i ended up reading your article...Smile

Steve Waters Vancouver
Steve Waters Vancouver United States
3/5/2012 5:17:06 PM #

That is an awfully astounding column that have posted. Thanks a lot for that fantastically amazing post!

Goodmedalist South Africa
7/17/2012 3:17:05 AM #

What about the significant overhead and complexity of .designer files that exist in a Web Application?

These are really unneccessary and make a project difficult to port or upgrade. Web Site does not create these. In a Web Site the Markup is interpreted as the design (as it should be) and additional '.designer' files are not necessary for each web page. Not having them in a 'Web Site' project type is a significant advantage over 'Web Applications'.

sara Iran
8/15/2012 1:14:21 AM #

how we can find the web form that contain a word in our website?

Pingbacks and trackbacks (14)+