How Do I...

Important: This documentation applies to 2.0 Beta only. The 1.0 documentation is here

Additional information is also available in the 2.0 Beta documentation. Download the standalone help file or refer to the documentation that the installer adds to Visual Studio.

configure my ASP.NET 2.0 website to use AIP?

  1. Open your web.config file. If you don't have one, create one by adding a new item to the project and select Web Configuration File as its type.
  2. Add the XML in Figure 1 to your web.config file.

use the AIP web control in my Visual Studio Web Site project?

You can add the AIP web control to a web form in Design view using the toolbox, or in Source view by declaring the control in HTML.

Add the AIP web control to Visual Studio's Toolbox
If you have successfully installed the AIP web control into Visual Studio using the AIP Installer then you do not need to follow these instructions; otherwise, follow these instructions so that you can drag and drop the AIP web control from the toolbox to your web form:
  1. Open the Toolbox in Visual Studio.
  2. Create a new tab and name it DaveSexton.Web.Controls.
  3. Right-mouse click the empty area under the tab and select Choose Items....
  4. In the Choose Toolbox Items dialog select the .NET Framework Components tab and click Browse....
  5. Browse to the AIP installation directory, commonly found at C:\Program Files\Dave Sexton\AIP.
  6. Select DaveSexton.AutoInputProtection.dll in the bin folder and click Open.
  7. Make sure that AutoInputProtectionControl is added to the list and that it is checked.
  8. Click OK.
Add the AIP web control to a web form in HTML view
If you'd prefer to add the AIP web control to your web form without using a designer:
  1. Open your web form in Source mode (HTML).
  2. Add the declaration in Figure 2 to your web form next to the other declarations at the top of the page.
  3. Add the XHTML in Figure 3 to your web form, wherever you'd like the control to be placed.
  4. If your project doesn't reference the AIP assembly then you should do that now (see the next topic).
Reference the DaveSexton.AutoInputProtection assembly
If you have successfully installed the AIP web control into Visual Studio using the AIP Installer then dragging AutoInputProtectionControl from the toolbox into a designer will automatically add a reference to the AIP assembly. To add a reference manually:
  1. In Solution Explorer, right-mouse click the project and select Add Reference...
  2. In the Add Reference dialog, select the Browse tab.
  3. Browse to the AIP installation directory, commonly found at C:\Program Files\Dave Sexton\AIP.
  4. Select DaveSexton.AutoInputProtection.dll in the bin folder and click OK.

choose the default text and image providers for my website?

After you have added the basic AIP configuration elements to your web.config file, you may want to configure your website to use a different text provider or image provider.

To specify a default text provider or image provider you must register them and use the defaultTextProvider and defaultImageProvider attributes, respectively, to assign them as the defaults.

See Figure 4 for an example configuration file that registers a default text provider and a default image provider.

For more information about providers see AIP Providers.

configure my website to use an AIP filter provider?

After you have at least added the basic AIP configuration elements to your web.config file, you may want to add filters to help randomize the output.

AIP has one built-in filter that renders translucent bars, vertically or horizontally. This particular filter is only applied after the text is drawn on the image.

Another built-in filter provider renders a random cross hatch style. This filter is also applied after the text is rendered.

To configure a filter in your application:
  1. Add the XML in Figure 5 to your web.config file.
  2. Configure the filter using XML attributes. The colors attribute is required for the filter providers used in the example.
Every filter that is configured will be applied. The order in which the filters are added to the filters configuration element is the order in which they will be executed at runtime, top-down.

See AIP Providers, Filter Providers for more information about filter providers.

create a custom AIP text provider?

To create a custom text provider you must create a class that derives from the DaveSexton.Web.Controls.Configuration.AutoInputProtectionTextProvider class, directly or indirectly.

The example in Figure 6 shows a fully functional text provider class named, RandomNumbersAutoInputProtectionTextProvider, written in C#, that will generate random numbers.

For more information about text providers see AIP Providers, Text Providers.

create a custom AIP image provider?

To create a custom image provider you must create a class that derives from the DaveSexton.Web.Controls.Configuration.AutoInputProtectionImageProvider class, directly or indirectly.

The example in Figure 7 shows a fully functional image provider class named, WhiteBackgroundAutoInputProtectionImageProvider, written in C#, that will render the background of an AIP image as solid white.

For more information about image providers see AIP Providers, Image Providers.

create a custom AIP filter provider?

To create a custom filter provider you must create a class that derives from the abstract DaveSexton.Web.Controls.Configuration.AutoInputProtectionFilterProvider class, directly or indirectly.

The example in Figure 8 shows a fully functional, post-process filter provider class named, BlueOverlayAutoInputProtectionFilterProvider, written in C#, that will render a translucent blue screen over the composite image. The composite image is the background image that is supplied by the configured image provider with the validation text generated by the configured text provider rendered on top.

To create a custom filter that processes the image before the text is rendered, override the CanPreProcess property and return true in your custom filter provider class. Then, override the PreProcess method and provide your implementation.

For more information about filter providers see AIP Providers, Filter Providers.

Last edited Apr 2, 2008 at 12:09 PM by davedev, version 3

Comments

No comments yet.