Pages

Monday, June 8, 2009

Visual Studio web site VS Visual Studio web application

Although, it seems that web site and web application are similar , I should emphasize that it is not.

If you don't understand the difference between these two and start implementing your application, you will be in real trouble. (Actually I faced that situation)

Web site

You can create a new web site by file => new => website.

There, you can browse and select the place where you want to save your website. If you like you can give a name for your web site in the path itself. (just over write the exsiting name. By default it is WebSite1 in file system.

In location drop down list, you will find 3 options which are file system, http and FTP.

If you select the location as file system, you should specify a folder in your hard disk or shared folder in another computer. This option does not require you to set up IIS (Internet Information Services) to host your web site, because you can use ASP.NET development server which is a built-in feature in Visual Studio 2008. Although, if you want to deploy web site in another server, you can set up your web site later in IIS as well.
(Right click on the website icon => property pages => start options => server => use custom server)

If you have IIS installed in your machine, you can create a virtual directory by right click on websites => default website and new => virtual directory and then point that to your local path of your web site.
If you select http as the location, then your folder will be saved in C:\Inetpub\wwwroot.
There’s an option called remote site. A remote Web site is a site that uses IIS but is on another computer that you can access over a local area network.

You can select an FTP server as your location by selecting FTP as well.
From this point onwards all the information is applicable for file system websites.

After you select every thing as required, Visual Studio will create a new solution for your web site. But when you want to open your web site what you have to do is go to File => open => Web site and select your folder there. Unlike web application projects, you can find your solution file in your website folder which is in My Documents => Visual Studio 2008 => Projects.

You don’t have a project file for your web site. (*.csproj) Further, you may notice that *.aspx.designer.cs files are missing.

Another special thing is there’s no bin folder. No assembly files are created when you build your web site. They will create in the run time. (I think!)

Web application

You create a web application project by File => new => Project => ASP.NET web application. You can specify the location you want to create your web application and if you like you can create a new folder for the solution. By checking ‘add to source control’ check box you can automatically add solutions and projects to source control.
Source control is a repository for the code where many developers can share the code and work on it.

When you build your project it is compiled to a single assembly which will be placed in the bin folder. You will find all the required files such as *.csproj, *.sln, web.config in the folder which you specified the path.


So, these are some differences I found and it is up to you to decide which approach will match your requirements precisely.







No comments:

Post a Comment