1. Home
  2. Computing & Technology
  3. Delphi Programming
What makes an Delphi 8 ASP.NET application
Let's see what the main parts of an ASP.NET application are; what are code-behind files and what are all those .aspx, .ascx, .dcuil, bdsproj, etc. files?
 Join the Discussion
"Post your views and comments to this chapter of the free ASP.NET Delphi Programming Course"
Discuss!
 Related Resources
• A Beginner's Guide to ASP.NET Programming for Delphi developers.TOC

 Elsewhere on the web
• ASP.NET MS's home page

Welcome to the third chapter of the FREE online programming course:
A Beginner's Guide to ASP.NET Programming for Delphi developers.
Let's see what the main parts of an asp.net application are; what are code-behind files and what are all those .aspx, .ascx, .dcuil, bdsproj, etc. files.

Loading the BDSWebExample in Delphi 8, for the first time...
Back in the last chapter, we've (more or less successfully) restored the database, and created a virtual folder under IIS in order to be able to run BDSWebExample for the first time - we have not used the Delphi for .NET IDE at all. In this session, our mission is to set up the project in Delphi 8, and to see what all those files that make an ASP.NET application are.

To load the BDSWebExample into Delphi 8, first launch Delphi :)
When you start the IDE you are presented with a "Welcome Page" - an HTML page featuring links to open your recent projects, containing options to create a new project, and a set of links to access resources on the Internet (like Delphi examples, training, other .NET solutions by Borland, etc).

Go to File - Open Project (or click "Open Project" on the Welcome page), and locate the BDSWebExample folder (if you have followed the Course from the beginning the code should be in "C:\InetPub\WWWRoot\BDSWebExample").

Delphi 8 ... Open Project

Locate the "BDSWebExample.bdsproj" and the "BDSWebExample.dpr" files. You can select either of them and click OK. The BDSWebExample.bdsproj is the "Borland Developer Studio Project file", this XML file is a project file containing information needed to build the project. The BDSWebExample.bdsproj in one of its nodes has a reference to "MainSource" that points to "BDSWebExample.dpr". The BDSWebExample.dpr is a standard Delphi project file. If you look inside this .dpr file, you'll note the first line: "library BDSWebExample;" - this means that every ASP.NET application compiles into a DLL (dynamic link library). We'll talk more on the purpose of the BDSWebExample.dll in the coming chapters.
Normally, you do not modify those two files manually, Delphi does this for you. The BDSWebExample.bdsproj also contains information about the virtual root of the application.

BDSWebExample at a glance
BDSWebExample files We'll now take a look at the elements of a Delphi ASP.NET Web Application.

When you create an empty asp.net application, Delphi creates the necessary files and folders on the server, sets the appropriate security settings for them, and creates the IIS application (virtual root, etc.). With this in mind, we could say that an ASP.NET application consists of a virtual directory in IIS and at least on ASP.NET web page ("WebForm"). Optionally, an application may also include:

- one global.asax file, located in the root of the application,
- one or more .css files - cascading style sheet files that allow developers to describe formatting that should be applied to document structures. Something like : "all links should appear underlined and bold, but not-underlined when a mouse hovers over them".
- one or more web.config files (one per sub-directory in the application). Web.config files are used for configuration of various settings withing an application.
- one or more .ascx files. Files bearing the .ascx extension represent web user controls. For the moment, think of an .ascx (user control) as a programming element similar to the TFrame component in Win32 Delphi.
- one or more .pas files. These can be code-behind classes, or stand alone Delphi units containing particular application code for business objects and application logic. The code-behind file contains the application logic that interacts with the visual components and ASP.NET server controls in your Web Forms page.
- a /bin folder (not visible in the Project Manager window) containing the compiled project's dll and .NET assemblies you use (under "References") in your application.
- any other type of file, typically images, XML files, or anything else that is "web-aware". The BDSWebExample "references" two more folders with pictures ("gfx" and "examplesGFX") and a folder for advert system (used by the AdRotator component along with the ads.xml file).

Note that we will discuss every one of the above files in much more detail in the following chapters of this Course.

Project Options for BDSWebExample.dll
Before we compile the BDSWebExample, let's see if all project options are properly set. Point to Project - Options (Crtl+Shift+F11) and select the "ASP.NET" tree node. The ASP.NET section of the Project Options, is used to setup debugger options for your ASP.NET application. You should see something like:

Project Options for BDSWebExample.dll
F9 = run and debug, Run - run without debugging
I would suggest that you now try to compile the project. Hit Ctrl+F9 ... if all goes well, there should be no errors and you can run the applications. Point to the Run menu and select "Run without debugging" ... a new IE instance should open and you'll see the startup page for the project: Default.aspx loaded in the browser. If you simply hit F9 you'll start with debugging and the Delphi IDE will show some more windows ... again, we'll deal with debugging later.

That's it for this chapter. Until the next chapter you should familiarize yourself with the IDE and the WebForms (ASP.NET pages) of the BDSWebExample application.

To the next chapter: A Beginner's Guide to ASP.NET Programming for Delphi developers
If you need any kind of help at this point, please post to the Delphi Programming Forum where all the questions are answered and beginners are treated as experts.

A Beginner's Guide to ASP.NET Programming for Delphi developers: Next Chapter >>
>> Your first "Hello World" ASP.NET Delphi application

Explore Delphi Programming
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Delphi Programming

©2009 About.com, a part of The New York Times Company.

All rights reserved.