The Nemesis Gallery architecture is pretty easy and straightforward. Nemesis gallery has three main functions:
  • Resize images and generate thumbnail - using the ThumbnailHandler.
  • Generate directory listing - using the DirectoryListingHandler.
  • Generate image information pages (when you do not want directly link the images from directory listing) - using the InfoPageHandler.


This handler can resize any picture to given dimensions. May be used to generate thumbnails, or just resize picture to fit the screen, if they are too big.

DirectoryListingHandler and InfoPageHandlers

Core task of DirectoryListingHandler is to take list of files of current folder and present it in form of a XML document. The InfoPageHandlers does the same for information available about any given photo.

The XML document can be sent directly to the client. This may even make sense for some scenarios - for example when some client program will parse and process these data. In most cases however we need to display some cute HTML to the client.

For converting XML document into HTML there is established technology: the Extensible Stylesheet Language - XSL. XSL is template (itself written in XML), which can convert XML to HTML using set of rules, from easy and simple to advanced. In fact, XSLT can convert basically everything, but we need it in this case for XML to HTML conversion.

Further information about template development may be found in the Template Developer Guide.


In Nemesis Gallery are lots of extensibility points. The XSL transformations themselves are very powerful technology and basically any changes in layout and lots of changes in UI logic can be realized using the XSLT templates themselves.

When XSLT itself does not suffice, you can write extensions using scripting languages (like JavaScript) and even managed programming languages (like C# or VB.NET).

The handlers can be used quite independently - for example, you can use only the ThumbnailHandler and write the HTML creation logic differently - for example using ASP.NET Web Forms and databinding.

Nemesis Gallery is basically extension of the Microsoft Internet Information Services itself and you can use it with other extensions. The WebSite-Secure sample for example integrates Nemesis Gallery with various authentication and authorization technologies to restrict access to certain parts of the gallery.

Last edited Nov 9, 2008 at 11:46 PM by altair, version 1


No comments yet.