Web Application Development with COBOL

Although Visual COBOL includes templates for creating COBOL Web Sites, Micro Focus recommends that you use the COBOL Web Application templates in Visual Studio to create applications for the Web since they enable you to use all of the Web functionality provided by the framework as well as take advantage of using a project. You configure Web Applications from the project properties. For Web Sites you specify configuration settings in the Web.config file.

The following sections summarize the two different ways of creating applications for the Web.

COBOL Web Applications

The recommended way to create Web applications is to use the Web Application templates (File > New > Project, and click Web under COBOL templates) as they give you control over your source code that is preferable to using the Web Site templates.

The main characteristics of using a Web Application are:

  • Project - the project file describes the files in your application and defines the project structure. It enables you to configure the project properties and add project dependencies so you can build multiple Web application projects as part of your application, and to temporarily exclude files from the build.

    Using a project file also means Visual Studio adds namespaces to pages, classes and controls.

  • Compiling - you use MSBuild to compile and can customize it by adding pre- or post-build events. The output of the Web Application project is a single assembly for which you can add an assembly name and version.
  • Deployment - you build the project on the development machine and only deploy the single output assembly to the production server which reduces the security risks. You use the Visual Studio deployment tools to deploy the assembly.

COBOL Web Sites

To create a Web Site, use a Web Site project - click File > New > Web Site, and then click the COBOL category.

The main characteristics of the Web Site project are:

  • Project - there is no project file. All files that are part of the folder structure are included in the Web Site. To configure the Web Site, you use the Web.config file.
  • Compiling - the source code is compiled dynamically on the production machine by ASP.NET after you have uploaded or updated the Web Site, and after receiving a request. A Web Site compiles to multiple assemblies.
  • Deployment - you deploy all source files and keep them on the production machine where they are compiled dynamically to produce multiple assemblies. Changes such as adding or removing files are picked up automatically.

For a more detailed comparison between Web Application and Web Site projects, check Microsoft's MSDN.