Web projects

mobile web form template visual studio 2010 download zvtha Elegant ASP NET MVC Installing AdminLTE dashboard to replace Bootstrap

So far, we’ve only covered how you can create websites without any project files. The advantage of project-free development is that it is a simple and straightforward process. If you create a project-free website, you don’t need to deploy any extra support files. Instead, each file located in the website folder is automatically considered part of the web application.

Project-free development continues to be popular for the following reasons:

  • It simplifies the development process itself. You just need to copy all the files from the website directory to the web server: there are no design or debugging files that should be avoided.
  • It simplifies file management. To delete a page, you can simply delete the associated files using any preferred file management program. To add a new page or move a page from one website to another, you only need to copy the files associated with it: you don’t need to deal with Visual Studio or edit the project file.Due to the lack of a project file to take care of, even author’s corrections can be made to web pages by other means.
  • It simplifies collaborative team work. Different people can work on different web pages separately, and you don’t need to lock any project files.
  • It simplifies debugging. When creating a web project, even if a single page is changed, the entire application must be compiled again. In the case of project-free development, each page is compiled separately, and only when it is requested for the first time.
  • Allows you to mix languages. Since each web page is compiled separately, the developer is free to write code for their pages in different languages. In the case of project development, it will have to create either separate web projects (which will complicate management), or separate projects of the class library.

Despite the above, there are also a few more specific reasons why project-based development or web-based projects may be preferred in certain scenarios.

Project-based development

When creating a web project, Visual Studio generates a set of additional files, including custom project files with the extension .csproj, as well as a solution file with the .sln extension. When building an application, Visual Studio generates temporary files that it places in the Obj subdirectory, and one or more .pdb files with debugging symbols that it places in the Bin subdirectory. None of these files should be deployed to the web server when the web application is ready.

Moreover, C# source code files (with the extension .cs), because Visual Studio pre-compiles them to a DLL assembly.

At first glance, pre-compilation of web projects seems to be a big advantage, because it not only ensures that pages don’t need to be compiled at the first request, but also avoids deploying source code on a web server. However, project-free websites can just as easily be compiled for deployment: you just need to use the appropriate pre-compilation tool.

Project-based development has its own fan base. The most important advantages of web projects are listed below:

  • The project development system is more strict than the project-free development system. The fact is that the project file explicitly lists all the files that should be included in the project. This allows you to intercept possible errors (such as missing files) and even analyze possible attack options (such as adding unwanted files by a malicious user).
  • Web projects provide more options for managing files. One example is when multiple projects are created and all of them are placed in subdirectories within the same virtual directory. In this scenario, the files are stored separately for development purposes, but they are still essentially part of the same deployment application. In the case of project-free development, it is not possible to place files separately in such subdirectories.For the same reason, it may be more efficient to use web projects when creating a web application that uses a huge number of resource files, such as a website that includes an Images subdirectory with thousands of different images. For project-free development, Visual Studio will detect these files and add them to the Solution Explorer window, since they will be part of the website directory. In the case of a web project, such additional overhead costs can be avoided, because you will not explicitly add these drawings to the list of project files.
  • Web projects provide the ability to configure the deployment process. Visual Studio project files work with the Web Packages tool, which provides additional features for configuring the deployed version of the application.
  • Web projects work better in some migration scenarios. Any web application that was created using Visual Studio 2003 or earlier is a web project, because in these versions of Visual Studio, it was not possible to create websites without using projects. Opening such a web project in Visual Studio 2010 triggers the migration wizard to convert this application to a Visual Studio 2010 web project.

Available functionality ASP.NET both project-free and project-based development look the same. Moreover, the performance indicators in both cases are also no different. So what is the best option to choose when creating a new ASP website?NET? Each approach has its own supporters.

Officially, Microsoft recommends using a simpler website model in all cases, except when there is a serious reason to use a web project. These cases include situations where a special MSBuild extension has been developed, when a thoroughly automated deployment process is already in place, when you are migrating to a new version of an old website created in Visual Studio 2003, or when you need to create several projects in one directory at once.

Creating a web project

To create a web project, select New –> Project from the File menu. This opens the New Project dialog box, which looks very similar to the New Web Site dialog box discussed earlier.

Select an item ASP.NET Web Application ASP.NET). Next, you need to specify the location, either as a file path or as a URL pointing to the local or remote IIS web server.

Just like when creating a project-free website, you can change the target version in the list at the top of the window .NET Framework. While web projects and project-free websites produce the same end result when deployed and compiled on a web server, there are some differences in the way they are structured during design.

These differences are listed below:Compilation

As explained earlier, web projects are compiled by Visual Studio when they are launched (not compiled by Microsoft). ASP.NET). Web page classes are combined into a single assembly, which gets the same name as the web project (for example, WebApplication) and then placed in the Bin folder.Separated code

Web pages in a web project always use the separated code model. However, they include one additional file with the extension. aspx. designer. cs, which contains declarations for all controls on the web page. This means that if you create a page named Default. aspx, you will get a file named Default. aspx. cs with the separated code class and a file named Default. aspx. designer.cs with control declarations:

At compile time, these two files will be merged. In a project-free website, you will never see a file with control declarations, because this part of the code is generated at compile time by the system ASP.NET. (Changed in VS 2012)The Page Directive

In web pages of a web project, the Page directive looks a little different. To point to a source code file, it uses the CodeBehind attribute instead of the CodeFile attribute. This difference is also due to the fact that the compilation is performed by Visual Studio, and not by the user. ASP.NET. Wednesday ASP.NET checks the CodeFile attribute, and Visual Studio checks the CodeBehind attribute.Links to assemblies

In a project-free website, all references to assemblies are fixed in the web.config file, so that ASP.NET it can use them when resolving links at compile time. However, in a web project, references to assemblies are saved in the project file that Visual Studio accesses when compiling code. The only exceptions are links to assemblies System.Core.dll and System.Web.Extensions.dll, which contain all specific functions .NET 3.5. These links are defined in the web. config file because they include the classes needed to specify new configuration parameters.

Leave a Reply

Your email address will not be published. Required fields are marked *

You May Also Like
Read More

Components .NET

A well-designed web application written for ASP.NET, will include separate components that can be organized as separate data…