web application projects v.s. web site projects [duplicate]

北战南征 提交于 2019-12-18 03:46:39

问题


I am reading from the following link,

http://reddnet.net/code/asp-net-web-site-vs-web-application-project-part-2/

My two confusions,

  1. What is the so-called issue "No control over your namespaces" cons from a web site project? Could anyone show me a sample to illustrate this issue please?

  2. What is the so-called issue "It is hard (read, nearly impossible) to reference pages, user controls, etc from custom classes in the app_code folder."? Could anyone show me a sample to illustrate this issue please?

I am using VSTS 2008 + .Net 3.5 + C#.

thanks in advance, George


回答1:


imagine a WebSite...

that is a simple web app, all alone in the world... remember, you can't add anything else to it, right...?

Now, how about a web project? that it's part of a Solution, and a Solution can have n projects, take my current work for example:

alt text http://www.balexandre.com/temp/2009-06-29_0816_so_question.png

In just one solution, I have more projects than the website, and even if they are in different directories I referenced those projects in the website and it's easy to edit, for example, the ExtensionMethods project when I need to add more.

This is something that you can't control in a WebSite, only in a Web Application Project.

The Web Application Project is like any other project, it includes all files that are in Projects like the proj extension file, and it's treated like a project, for example, you can exclude files to be compiled (you can't in a Website), it is easier to deploy because of the nice plugin called Web Deployment Project", just right click in your WebSite project and choose Add Web Deployment Project...

alt text http://www.balexandre.com/temp/2009-06-29_0825_soanswer.png

And you can deploy only this project (add it to your Web Setup, in order to create the msi file) and you will deploy a compiled website (no source code is showed, all code is compiled into dll's so you can hide the source).

There are numerous advantages to use Web Application Project over a simple Website...



来源:https://stackoverflow.com/questions/1056797/web-application-projects-v-s-web-site-projects

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!