Highlander ASP.NET Feature Overview

By: Dee Elling

Abstract: Important supplementary information that may not yet appear in the main product documentation.

    ASP.NET Feature Overview

This file contains important supplementary information that might not appear in the main product documentation.

For an updated version of this document, see the CodeGear Developer Network ( http://dn.codegear.com/article/36892/ ).

    Contents

    ASP.NET

ASP.NET is the .NET programming environment for building applications that run on the Web. Its implementation in CodeGear RAD Studio is based on .NET 2.0.

ASP.NET architecture and usage is documented both in CodeGear Help topics and MSDN documentation. For instance, see http://msdn2.microsoft.com/en-us/library/ms644563(vs.80) for an overview in MSDN documentation. This document contains information that does not appear in the Help system.

Top

    New Features

    Master Pages

A master page is a page on which you can define elements that you want to use in other pages on your Web site. Content pages can reference a master page and automatically have those elements provided on the page. This provides a way to give Web sites a uniform appearance.

See the topic Building an ASP.NET SiteMap in the product documentation for an example of creating and using master pages for content pages.

    Site Maps and Other Site Navigation Mechanisms

A site map is a file that describes a Web site's structure. You can add menu and sitemappath controls to Web pages that use the site map path to navigate a site. Adding such controls to a master page is a simple way to provide site navigation.

See the topic Building an ASP.NET SiteMap in the product documentation for an example of creating a site map and adding menu and sitemappath controls to a master page.

Top

    Deprecated Features

The DB Web controls in the Borland.Data.Web namespace have been deprecated. The ASP.NET 2.0 Web controls offer equivalent capability to the DB Web controls.

Top

    Using Databases

CodeGear's ASP.NET provides data aware controls that simplify connecting a database to your Web application.

See the topics Developing an ASP.NET Application with Database Controls, Parts 1, 2, and 3 in the product documentation for a detailed example that shows some of the fundamentals of using ASP.NET:

  • Creating an ASP.NET project
  • Adding components to a form
  • Using the Smart Tasks window to configure components
  • Configuring and connecting to a data source
  • Changing the configuration of a data source
  • Using SQL to read data from a database
  • Editing markup to change a component's appearance
  • Running the application in a browser

Top

    Providers

    Overview

ASP.NET 2.0 includes a number of services that store state in databases and other storage media. For example, the membership service stores user names, passwords, and other data in Microsoft SQL Server databases or Active Directory. This architecture is known as the "ASP.NET 2.0 Provider Model" and is described at http://msdn2.microsoft.com/en-us/library/aa479030.

The provider model allows developers and tool vendors to create custom providers that can store state in other types of databases, XML files, text files, or even data sources front-ended by Web services. Any data repository that is rich enough to hold the data required for the services of the provider model may be used.

RAD Studio includes a set of ASP.NET providers that may be used by ASP.NET applications as a replacement for, or in addition to, the providers that are supplied with the .NET framework. RAD Studio includes Membership, Roles, Profile, Web Events, and Web Parts Personalization providers.

These providers are modeled after the Microsoft SQL Server providers included with the .NET framework. They provide the same functionality and use the same basic database schema. The primary difference is that the RAD Studio providers use generic ADO.NET database classes to access the database and therefore can support most databases that have an ADO.NET provider.

NOTE: Do not confuse database providers with ASP.NET providers; they are completely different things.

As shipped, RAD Studio providers are configured to work with the Blackfish SQL local database, but can also be configured to use Interbase via the Ado Dbx Client Provider.

    Provider Registration and Configuration

See the Provider Registration and Configuration section in http://msdn2.microsoft.com/en-us/library/aa479030 for information about how providers are registered in <providers> configuration sections of machine.config and web.config files.

The providers included with RAD Studio are automatically registered in both the system wide .NET machine.config file as well as in the web.config file that is part of each ASP.NET project. For more information about these configuration files, see the ASP.NET Configuration Files topic online at http://msdn2.microsoft.com/en-us/library/ms178684.

The RAD Studio entries are as follows:

<membership defaultProvider="AspNetAdoMembershipProvider">
    <providers>
        <remove name="AspNetAdoMembershipProvider"/>
        <add name="AspNetAdoMembershipProvider"
             type="Borland.Web.Security.AdoMembershipProvider, Borland.Web.Provider, Version=11.0.5000.0, Culture=neutral, PublicKeyToken=91d62ebb5b0d1b1b"
             connectionStringName="BlackfishSQLAspNet"
             applicationName="/"
             enablePasswordRetrieval="false"
             enablePasswordReset="true"
             requiresQuestionAndAnswer="true"
             requiresUniqueEmail="false"
             passwordFormat="Hashed"
             maxInvalidPasswordAttempts="50"
             minRequiredPasswordLength="8"
             minRequiredNonalphanumericCharacters="1"
             passwordAttemptWindow="10"
             passwordStrengthRegularExpression=""/>
    </providers>
</membership>

<profile defaultProvider="AspNetAdoProfileProvider">
    <providers>
        <remove name="AspNetAdoProfileProvider"/>
        <add name="AspNetAdoProfileProvider"
             type="Borland.Web.Profile.AdoProfileProvider, Borland.Web.Provider, Version=11.0.5000.0, Culture=neutral, PublicKeyToken=91d62ebb5b0d1b1b"
             connectionStringName="BlackfishSQLAspNet"
             applicationName="/"/>
    </providers>
</profile>

<roleManager enabled="true" defaultProvider="AspNetAdoRoleProvider">
    <providers>
        <remove name="AspNetAdoRoleProvider"/>
        <add name="AspNetAdoRoleProvider"
             type="Borland.Web.Security.AdoRoleProvider, Borland.Web.Provider, Version=11.0.5000.0, Culture=neutral, PublicKeyToken=91d62ebb5b0d1b1b"
             connectionStringName="BlackfishSQLAspNet"
             applicationName="/"/>
    </providers>
</roleManager>

Two other providers, AspNetAdoPersonalizationProvider and AspNetAdoWebEventProvider, are also included with the product, but are not registered by default. To use either of these providers, it is necessary to add entries to the web.config file for them. See the "Web Event Providers" and "Web Parts Personalization Providers" entries in the ASP.NET provider documentation available online at http://msdn2.microsoft.com/en-us/library/aa137088.

    Provider connectionStringName property

Each of the providers expects a connentionStringName property to be set when initializing. This string specifies the database connection to be used the provider. The default value of the connectionStringName is a pre-defined string that is included in the web.config file. The connection is named BlackfishSQLAspNet and is configured to use the Blackfish SQL database using the a special "|DataDirectory|" placeholder that is expanded to the full path of the "App_Data" directory below the ASP.NET web application project.

To use a different database for storing the data from the providers, either redefine the BlackfishSQLAspNet entry in the connectionStrings section of the web.config file or add a new entry. If you use a new entry with a different name, you need to also update the provider entries in the web.config file to use the new connectionStringName value.

    Database Setup

For a database to be used by the ADO ASP.NET providers, it must first be initialized by creating the tables used for storing the data. RAD Studio includes a command line tool, aspnet_regdb.exe, that initializes an existing database. The tool relies on "MetaData" services that are also provided with RAD Studio. Currently, the MetaData services only work on Blackfish SQL and Interbase through the Ado Dbx Client Provider.

When a new ASP.NET web application is created and run with a Blackfish SQL using the |DataDirectory| placeholder in the connection string, the database is automatically created and the tables setup, so there is no need to use the database setup tool in that case. This is the default for all new Delphi ASP.NET web applications and web services.

To use aspnet_regdb.exe, pass it a connectionString, which is defined in the machine.config file or in the dbxconnections.ini file. The tools takes one of two switches to indicate if the tables should be added (-A) or removed (-R) from the database. Execute aspnet_regdb.exe with no parameters to display addition usage information. Note that aspnet_regdb.exe is installed into the .NET framework directory (typically C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727).

Top

    Using an IIS 7.0 server under Vista

To use Delphi.NET's ASP.NET support with an IIS 7.0 server under Vista, do two things:

  1. Enable the IIS 6 Management Compatibility Feature.
  2. Run Delphi.NET 2007 as an Admistrator.

You can enable the IIS 6 Management Compatibility feature with the following steps:

  1. On the Vista Control Panel, select 'Programs and Features'.
  2. Click 'Turn Windows features on or off'. This launches the 'Windows Features' dialog.
  3. Select the 'Internet Information Services\Web Management Tools\IIS6 Management Compatibility' node in the tree and enable the 'IIS Metabase and IIS6 configuration compatibility'.

The same issue applies to Visual Studio, so the same steps are required. See the following blog for more information on the required configuration: http://blogs.msdn.com/webdevtools/archive/2006/09/18/761206.aspx

Top

    Deployment

To deploy an application that uses the RAD Studio providers, you need to include the following files:

  • Borland.Web.Provider.dll
  • Borland.Delphi.dll
  • Borland.VclRtl.dll

In addition, if you are using Blackfish SQL, you need to deploy one of these 2 assemblies:

  • Borland.Data.BlackfishSQL.RemoteClient.dll
  • Borland.Data.BlackfishSQL.LocalClient.dll

New applications are configured by default to use the RemoteClient version, which uses a service that is installed with the product. For deployment you may wish to use the LocalClient instead, since it does not require any special configuration or setup. The LocalClient only allows one process to access the database at a time, so it may be awkward to use for development. For instance, if you run the ASP.NET configuration manager and the application simultaneously, you get Access denied errors.

Top

Server Response from: ETNASC03