Tutorials
ASP.NET 2.0In this tutorial you will learn how to create Dynamic Image Control, DynamicImage Control Properties and Custom Parameters.
The DynamicImage control derives from the DynamicImageBase which is in turn derived from Image. This control acquires image bytes from varied sources and renders them to image capable devices using an internal normalization process. It stores the images in the System.Drawing.Image object and is cached in ASP.NET Cache with a randomly generated key. The HTML generates a < img > tag. The CachedImageService.axd URL is a built in HTTP handler which retrieves the image from the cache object and serializes its bytes to the browser using the proper content type. The data parameter of the Query handler string is used to select the image. The ImageUrl property can be used to find the URL of the image. The DynamicImage has the following properties.
The DesktopScaling property refers to resizing of the image on the desktop while MobileScaling refers to scaling the image on the mobile devices.
The DynamicImage control links to databases and to xml files. Images can also be dynamically generated using this control. The custom Image Generation Service can also be used. A file with the extension .asix is defined for the image generation services. Image generation handlers are defined at runtime and cached in server memory. The image generator takes a string and creates an image that represents it. Custom image generators can also be created by inheriting from ImageGenerator and overriding the RenderImage method. The image is referenced using the ImageGeneratorUrl property pointing to the ASIX handler. The image object can be received as a QueryString collection or the Parameters collection. This can be defined programmatically using the name/value interface.
In the next sections of this tutorial we shall examine the advanced site functionalities that have been built into ASP.NET 2.0.