Tuesday, March 6, 2012

ASP.NET Website Vs. Web Application Simple Comparison

Well, this looks much same as you see. In English, Website is a sort of a Web Application. But from the developer’s perspective, the Web Application project type and the Website Project Type have many differences. If you are a Visual Studio 2005 user, You will not get Web Application Project type if you have not installed Service Pack 1.

There are four major differences of each as they are highlighted.
1) Visual Studio Project File
A Web Application stores information about the project such like the list of files available and the references that the project has included. This is under the extension of .csproj or .vbproj depending on the language used for coding. A Website does not contain such information file and it just list all the files in the folder structure into a site.
It is easy to temporarily remove files from the site but still make sure that you do not lose track of them, because they remain in the folder structure. For example, if a page is not ready to be deployed, you can temporarily exclude it from the build without deleting it from the folder structure. You can deploy the compiled assembly, and then include the file in the project again. This is especially important if you are working with a source control repository. Therefore the Web Applications does suppose to be better than the website at this point as the only difference is availability to copy and paste without compiling in websites. Compiling does not take that much of a time. So Web Applications ROX…
2) Point of Compilation
A Website has its code in a special App_Code directory and it’s compiled into several assemblies(DLL) at run-time. A Web Application is pre-compiled into one single Assembly.
Compiling in advance makes sure that users do not have to wait while the site compiles on the production server. (If the site is very large, dynamic compilation of a Web site project might take a noticeable amount of time. Dynamic compilation occurs when a request for a site resource is received after an update to the site, and the request that triggers compilation might be delayed while the required resources are compiled.
In other ways, Website makes the ease of testing without waiting for the changes of the dependent files. Therefore, I would prefer websites for a small scale application and if needed to be changed the source frequently as you cannot change the entire source at once and test. If it is a website, small parts of the website can be changed easily. So, there are still advantages using websites.
3) Explicit Namespaces
In a Web Application, explicit namespaces are added to pages, controls, and classes by default. But in a website you need to add them manually.
4) Deployment on Server
A Website can be either copied directly or pre-compile and put the set of files into the destination. In Web Applications, you will have to compile and publish the application assemblies that will be running on the IIS server. There is a rich support for compilation of Web Applications in Visual Studio but less likely to be for Websites.
Here we have the security conformance. If you are using a web application, it is 100% sure that your source code is not exploited to who ever the person do even hack the server. Form developer’s perspective, you can demand the source code for a higher amount as you still provide the functionality without it.

No comments:

Post a Comment