RAD Studio for Microsoft .NET |  |

ASP.NET Overview
ASP.NET Architecture | Web Forms, Server Controls, and HTML Elements | Data Access | Web Services | Supported Web Servers | Designtime Features | Sample Applications | See Also
Collapse All

ASP.NET is the .NET programming environment for building applications in HTML that run on the Web. This topic provides introductory information about the major components of the ASP.NET architecture and explains how ASP.NET integrates with other programming models in the .NET framework. This topic introduces:

- ASP.NET Architecture
- Web Forms
- Data Access
- Web Services
- Designtime Features
- Supported Web Servers
- Sample Applications

ASP.NET Architecture

The major components of the ASP.NET architecture are Web Forms, ASP.NET server controls, code-behind logic files, and compiled DLL files. Web Form pages contain HTML elements, text, and server controls. Code-behind files contain application logic for the Forms page. Compiled DLL files render dynamic HTML on the web server.

CodeGear provides tools to simplify ASP.NET development. If you are familiar with rapid application development (RAD) and object oriented programming (OOP) using properties, methods, and events, you will find the ASP.NET model for building Web applications familiar.

Web Forms, Server Controls, and HTML Elements

Web Forms define the user interface for your Web application. Typically, a Web Form consists of a markup file (.aspx) that provides the visual presentation and a code-behind file (.pas or .cs) that provides the program logic. The code-behind file is compiled to a .dll and deployed to the server with the .aspx file. At runtime, the .aspx is compiled and linked against the code-behind .dll. This enables you to change the .aspx file without recompiling the code-behind file.

The Web Form .aspx file consists of ASP.NET server controls and static HTML elements. Server controls are declared in your code and can be accessed programmatically through properties, methods, and event handlers. They run on the web server and render HTML to send back to the client.

HTML elements are static, client-side controls; they are not, by default, programmatically accessible. However, they are well suited for static text and images on a Web Form.

Data Access

Web Forms can access data through ADO.NET. You can connect an ASP.NET application to an ADO.NET data source by using the data components included in the .NET Framework, the AdoDbx Client, Blackfish SQL, or the Borland Data Provider (BDP.NET) components.

Web Services

Web Services provide application components to many distributed systems using XML-based messaging. A web service can be as simple as an XML message updating values in a remote application or can be an integral part of a sophisticated ASP.NET or ADO.NET application. Web Services and ASP.NET share a common .NET infrastructure that allows for seamless integration.

Supported Web Servers

RAD Studio supports two servers for developing ASP.NET applications: Internet Information Services 6.0 (IIS) and Cassini. You can use both IIS and Cassini on the same computer, provided you configure them to use different ports.

- IIS is a comprehensive, scalable web server and is included with Windows Server 2003. You can deploy applications to a computer running IIS.
- Cassini is a web server this is used during the development process, but is not intended for application deployment. It is easier to use than IIS because there is no configuration. Cassini was developed by Microsoft and made available for free download with source. RAD Studio ships with a slightly customized version of Cassini that is integrated into our ASP.NET support.

When you create an ASP.NET application, RAD Studio prompts you to specify the web server and location for the application. You can set the default server and location for new applications, as well as the Cassini location and port, on the ToolsOptionsASP.NET options page.
Designtime Features

RAD Studio provides several designtime features to help you accelerate the development of Web Forms, HTML, and CSS files.

Editing HTML and CSS Files

Many of the Code Editor features are also available when editing HTML and CSS files. Code Completion (CTRL+SPACE) and syntax highlighting are available for HTML and CSS files. Error Insight is available for HTML files and highlights invalid HTML with a wavy red underline. If you position the mouse over the highlighted HTML, a hint window is displayed indicating the probable cause of the error.

When displaying an HTML page, the internal HTML formatter automatically indents the HTML to improve readability. Alternatively, you can use HTML Tidy, the standard formatting tool from www.w3c.org. You can use HTML Tidy as needed to format the file and check for errors by choosing the EditHTML Tidy menu commands. Alternatively, you can set it as the default formatter, instead of the internal formatter. You can also define tags that HTML Tidy would otherwise detect as invalid, such as those prefixed with asp:. To access the HTML Tidy options, choose ToolsOptionsHTML Tidy Options.

The Structure View displays a hierarchical tree view of the HTML tags in the active HTML page and is useful for navigating large files. Double-clicking a node in the tree view positions the HTML file to the corresponding tag.

Designer Flow Layout and Grid Layout

When designing a Web Form, you can use either grid layout or flow layout for the Designer. In grid layout, controls are arranged by absolute position and you can reposition them by dragging them on the form. An optional, visible grid is also available to help you align controls. If you drag a control from the Tool Palette onto the Web Form, or if you click the control on the Tool Palette and then click Web Form, the control is added using absolute positioning.

In flow layout, controls are arranged top to bottom on the Web Form, and you can reposition them by using the arrow keys. If you double-click a control on the Tool Palette, it will be added to the Web Form in flow layout.

The layout for an individual control can be changed by using the Absolute Layout button on the HTML Design toolbar at the top of the Designer.

To permanently change the layout for new files created with RAD Studio, you can edit the page.aspx template file located at, by default, CodeGear\RAD Studio\5.0\ObjRepos\DelphiDotNet.

Sample Applications

RAD Studio includes several ASP.NET sample applications in the Demos directory. Many of the sample applications include a readme file that explains the application and lists any prerequisites. Before you attempt to open a sample application in the IDE:

- Check for a readme file in the application's directory and follow any set up instructions.
- Create a virtual directory for the sample application to avoid resource cannot be found errors in the browser at runtime (see the procedure listed at the end of this topic).

See Also

ADO.NET Overview

Web Services Overview

Building an ASP.NET Application

DB Web Controls for ASP.NET

Deploying ASP.NET Applications

Creating a Virtual Directory for Demo Applications

System.Web Namespace

.NET Framework Developer's Guide ASP.NET Web Applications (MSDN)

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!