Friday, August 8, 2008

Advantage ASP.NET Providers Configuration

This post is one of a series of posts about the Advantage Providers for ASP.NET other posts in this series are listed below.

In my previous posts I have discussed the implementation of various providers which use Advantage Database Server as the data store. This post will focus on using the providers which are in a single DLL (AdsProviders.dll) which can be downloaded here. The zip file also includes a data dictionary which is used to store the user data.

The providers were compiled using version 8.1 of the Advantage .NET Data Provider and therefore require version 8.1 or newer of the Advantage server.

Installation Steps

Once installed and configured the Advantage ASP.NET Provider will be used by the standard ASP.NET Login Controls. The provider consists of a single DLL (AdsProviders.dll) and a Data Dictionary (AdsAuth).

  1. Place the AdsAuth.add and AdsAuth.am files into a directory accessable to the WebServer. The required tables will automatically be generated when they are first accessed. The provided dictionary does not have an ADSSYS password assigned, it is highly recommended that you establish a strong password for the database prior to use in a production environment.
  2. Copy the ADSProviders.dll to the BIN directory of your WebSite.
  3. Add a reference to the Advantage .NET Data Provider to your WebSite.

Configuration

Each of the providers requires a connection string to be defined in the web.config file. This must point to the dictionary containing the required tables outlined in installation steps section above. An example of the connection string entry is below.

<connectionStrings>
  <add name="LoginServices" connectionString="data source=C:\Data\aspauth\aspauth.add; 
                        ServerType=REMOTE; User ID=adssys; Password=password;"/>
</connectionStrings>

To use the AdsMembershipProvider it must be defined in the web.config file. Details on the various options are available from Microsoft. It is important that the name provided for the connectionStringName property is one of the connection strings defined in the web.config file

<membership defaultProvider="AdsMembershipProvider" userIsOnlineTimeWindow="15">
  <providers>
    <add name="AdsMembershipProvider" type="AdsMembershipProvider" connectionStringName="LoginServices" 
        enablePasswordRetrieval="true" enablePasswordReset="true" requiresQuestionAndAnswer="true" 
        writeExceptionsToEventLog="true" passwordFormat="Encrypted"/> 
  </providers> 
</membership> 

To use the AdsRoleProvider it must be defined in the web.config file. Details on the various options are available from Microsoft. An example is provided below:

<roleManager defaultProvider="AdsRoleProvider" enabled="true" cacheRolesInCookie="true" 
    cookieName=".ASPROLES" cookieTimeout="30" cookiePath="/" cookieRequireSSL="false" 
    cookieSlidingExpiration="true" cookieProtection="All"> 
  <providers> 
    <add name="AdsRoleProvider" type="AdsRoleProvider" connectionStringName="LoginServices" 
        writeExceptionsToEventLog="True"/>
  </providers> 
</roleManager> 

In order to use an encrypted or hashed password a MachineKey must be defined. The machine key is used to encrypt passwords in the table. Many tools are available to generate machine keys on the Internet. Scott Forsyth developed a machine key generator and posted it on OrcsWeb. An example is posted below:

<machineKey ValidationKey='07A557873B9CC1E1D788724A4C1B1FB4D969986DAA4A1085E64 
    CE3720B626F07DB6F679A362CFA0078D03ACE3B8B5E083252B3E60454F887107CCF19CF63FE3B' 
    decryptionKey='37485C760ED3869F1479ABD76CC57AB7C0CD94F63CA07710' validation='SHA1'/> 

1 comment:

Anonymous said...

Who knows where to download XRumer 5.0 Palladium?
Help, please. All recommend this program to effectively advertise on the Internet, this is the best program!