DynamicImage Image Generation Service configuration

The difference between the ASP.NET Image server control and the DynamicImage is the first one points to the exact image location when the second one points to ASP.NET extension (Http Handler) representing the so called Image Generation Service passing in the query string the image location and other params used for image generation.

In other words, the DynamicImage comes with a second component - DynamicImageProvider - that manages DynamicImage requests by applying transformations to the original image.

The DynamicImageProvider is an HttpHandler shipped along the DynamicImage server control in the same assembly; still, it needs to be registered so the web application will pass the DynamicImage image requests to it. The registration takes place in Web.config file.

<system.web>
  <httpHandlers>
    <add path="dynamicimage.axd" verb="*" type="SharpPieces.Web.Controls.DynamicImageProvider, 
      SharpPieces.Web.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" 
      validate="true" />

The Web.config registration is automatically done when you use the control in the ASP.NET designer; also, make sure you have the server control page registration.

<%@ Register Assembly="SharpPieces.Web.Controls" Namespace="SharpPieces.Web.Controls"
    TagPrefix="piece" %> 

In advanced scenarios, the DynamicImageProvider can be replaced with a derived Image Generation Service; in this case the best approach would be to derive also the DynamicImage and to override the HttpHandlerType and HttpHandlerName properties and in this case the Web.config registration is automatically done by the ASP.NET designer.