Wednesday, December 31, 2008

Gallery Server Pro Version 2.2.3286 Released

Today I am pleased to release version 2.2 of Gallery Server Pro. It introduces a totally revamped UI architecture that makes it much easier for developers to add a gallery into an existing ASP.NET web application. Another significant feature is support for storing media files on UNC shares, including NAS devices. There is a new Upgrade Wizard, and a handful of other new features and bug fixes, too. The database schema has not changed, so upgrading is as simple as replacing the web files and using the new Upgrade Wizard to import your web.config and galleryserverpro.config settings. Over the coming days I will update the Administrator's Guide. Until then refer to the 2.2 QuickStart Guide.

Simplified integration

It has always been easy to deploy GSP as a stand-alone web application, but getting it to work inside your existing web site has been difficult. That's because until 2.2, GSP consisted of a collection of master pages and .aspx pages that use an ASP.NET theme. There was no easy way to incorporate this functionality into your site. The most common approach has been to install GSP as its own web application and then use an iframe in one of your pages to create the illusion of integration. But this is not true integration, and some hosting companies make managing more than one application difficult.

So for 2.2, I built a new UI architecture based on the concept of an ASP.NET user control. No more themes, no more master pages. There is just a single web page - default.aspx - that contains a single user control. All the functionality you are used to - browsing albums and images and managing your gallery - occur within this user control. Read my previous blog post to see an example of adding a gallery into a web site.

The developers reading this might be imagining one giant user control with 100,000 lines of code that is a maintenance nightmare. Relax, don't worry. The single user control I mentioned - named Gallery - is actually a container control that loads the appropriate child user control based on the query string in the URL. The .aspx pages that existed in the previous version are recreated as .ascx controls in 2.2. For the most part I copied and pasted the code. There is a nice separation of presentation and logic in the UI layer that should make it easy to wrap your head around.

Upgrade wizard

A pain point in upgrading GSP to newer versions has been trying to incorporate your existing user settings in galleryserverpro.config with the updated HTML templates and settings in the new version. I addressed this by building a new Upgrade Wizard that automatically imports common settings from your previous web.config and galleryserverpro.config files. It even runs in medium trust.

This is the first page of the wizard:


Network support

Thanks to a code contribution from UncleJohnsBand, GSP now supports storing media files on UNC shares in addition to the web server's hard drive. This includes other computers, external hard drives, and even network-attached storage (NAS) devices.

Note that the IIS application pool identity must have file share permission and NTFS permission to the network location. The default user - Network Service - does not have network permissions and will not work. To get the web server to read and write to a UNC share, you must modify the application pool identity in IIS to specify another user, and then ensure that user has the required permission to the network device.

Silverlight now rock solid

Ever since adding Silverlight support in 2.1 for .mp3, .wma, .wmv, .asf, and .asx files, I have had trouble getting Silverlight to accept media files sent from GSP's custom HTTP handler. This only affected Firefox; IE worked well. I finally tracked down the issue and modified the handler to make both web browsers happy. Now that the handler is correctly working, I modified the HTML templates in galleryserverpro.config to use {MediaObjectUrl} (which uses the handler) instead of {MediaObjectAbsoluteUrlNoHandler} (which uses a direct link to the file) for these file types.

The end result is that these video and audio files should play great in all browsers, and you have the robust security that comes from using the handler.

Smaller font

The font size of the text throughout the gallery has been slightly reduced, and it is now defined in pixels rather than em in the CSS file. There is a debate in the CSS community as to how to best define the font size, and in my judgment em was the best choice when IE 6 was a dominant browser. Now that IE 6 is becoming irrelevant, I believe pixels is the best choice. Originally, the CSS file had this line:

body { font: 0.9em Verdana, Arial, Helvetica, sans-serif; background-color: #f5f5f5; color: #000; }

Now that GSP is wrapped in a user control, I specify the font size in the global CSS namespace:

.gsp_ns { font: 12px Verdana, Arial, Helvetica, sans-serif; }

Any time GSP needs to display larger or smaller text, it is done relative to the font defined in the gsp_ns class. For example, to display slightly larger text, GSP uses the gsp_fl class:

.gsp_fl { font-size: 1.1em; }

The beauty of this approach is that you can change the font size globally in one place - the gsp_ns class - and all the text will scale appropriately. So if you like the bigger text of the previous version, just edit the font size in gsp_ns. Increase it to 14px or even revert back to the original 0.9em. Whatever yanks your crank.

While we're talking CSS, you may have noticed I changed the background color of the header from blue to the same eggshell white used on the rest of the page. This is due partly because I am getting sick of that color, but also because the color is likely to clash with most web sites that developers add the gallery to. It is easy enough to change the color to suit your fancy. Edit the following line in gs\styles\gallery.css:

.gsp_ns .header { background-color:transparent; overflow:hidden; }

If you change to a dark color, you will probably want the title and login and search controls to use a light color so that it is contrasted against the background. Again, this takes a few simple edits to the CSS file. I'll leave that as an exercise for you. Hint: Use the Firebug add-on for Firefox to quickly identify the CSS classes to modify.

Complete list of new features (view detailed report)

  • All functionality is contained within a single user control.
  • Support for storing media objects at any UNC-accessible location, including NAS devices
  • New upgrade wizard imports settings from the previous web.config and galleryserverpro.config files.
  • Added .pps (PowerPoint Slideshow) as a supported media object
  • The file path to the thumbnail and optimized image directory is now optional
  • Modified add objects page to eliminate use of images containing hard-coded English text
  • New configuration settings in galleryserverpro.config: showLogin (default=true) and showSearch (default=true). These control the visibility of the login and search controls at the top right of every page. The settings are exposed on the General page of the Site admin area
  • New configuration settings in galleryserverpro.config: showErrorDetails (default=false), enableExceptionHandler (default=true), and allowAnonymousBrowsing (default=true). These replace the previous technique of configuring these options in web.config through the customErrors and authorization elements.
  • Increased the height of the box surrounding thumbnail images to better contain the contents. This was done by changing the value of the thumbnailHeightBuffer setting in galleryserverpro.config from 65px to 70px.

Bug fixes (view detailed report)

  • Full support for Silverlight using the HTTP handler
  • Password validation not performed when changing password in SQLite
  • An error may occur if a SMTP server is not specified
  • Clicking current date in edit album window does nothing
  • "Template not found: enabledHeader" message on Media Object Types page
  • Thumbnails for external media objects may not be recreated during synch
  • Synch may leave orphan files
  • Captions inside thumbnails sometimes exceed boundary
  • Incorrect behavior on Add Objects page
  • Text in add user dialog remains visible during callback
  • SQLite user activity date inconsistent with SQL Server behavior
  • Rendering issue when gallery is used in web page with floated screen objects

I hope you enjoy the new version, and I wish everyone a Happy New Year! As soon as I finish the Admin Guide, I'll get hard at work on the next release. I'll be publishing a new roadmap within a few weeks. Cheers!

Monday, December 1, 2008

Coming in 2.2: Improved Integration With Existing Web Sites

The next version of Gallery Server Pro, expected within a month or so, will have an improved UI architecture that will simplify the integration with your existing web site. Although I took advantage of .NET 2.0 techniques such as master pages and themes in GSP 2.0 and 2.1, in practice it has been difficult for developers to add an instance of Gallery Server Pro into an existing web application. This is primarily because an existing site already has an architecture that may include master pages, themes, navigation bar, and header and footer areas. Developers have achieved the look of integration by including GSP in an iframe or by copying their master page into GSP's master page. Neither of these is true integration as GSP still runs as a separate web application in IIS.

For 2.2, I refactored the user interface so that all functionality is wrapped in a single ASP.NET user control. Adding a gallery to your site involves three basic steps:

  1. Copy the Gallery Server Pro files into your web application. Most of them can be placed in a directory of your choosing. A few, such as the SQLite database and .resx resource file, go into pre-defined ASP.NET directories, such as App_Data and App_GlobalResources.
  2. Configure web.config to define a few settings required by GSP and add one line of code to the Application_Start event in global.asax.
  3. Choose one of your web pages to host the gallery. Perhaps you will add a new .aspx page and have it based on your current master page. Add the following to the top of the page:

    <%@ Register TagPrefix="gsp" Namespace="GalleryServerPro.Web" Assembly="GalleryServerPro.Web" %>

    At the location in the page where you want the gallery to appear, add this:

    <gsp:Gallery ID="gallery1" runat="server" />

That's it! Fire up the page and you will notice Gallery Server Pro appears in the location you defined. All the functionality that previously existed, such as logging on, searching, and the task and admin pages are still there. And it will work beautifully with your existing master pages.

As an example, here are a couple screen shots where I added a gallery to a new page named demo.aspx at



The demo.aspx page looks like this:

<%@ Page Title="" Language="C#" MasterPageFile="~/master/global.Master" AutoEventWireup="true"
    CodeBehind="demo.aspx.cs" Inherits="TIS.GSPWeb.demo" %>
<%@ Register TagPrefix="gsp" Namespace="GalleryServerPro.Web" Assembly="GalleryServerPro.Web" %>

<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <asp:ScriptManager ID="sm" runat="server" />
    <div id="content">
        <gsp:Gallery ID="gallery1" runat="server" />

Pretty simple, huh? You can see that it uses a master page named global.Master. GSP requires a ScriptManager because of its AJAX capabilities, so you'll need to make sure you have one defined on the .aspx page or in the master page.

Those of you who run GSP as a stand-alone application can continue to do so. I will release the code in a fully functioning web site with a single page containing the Gallery control. It will work much like you are used to, except you'll notice that the URL's are different. For example, here are a few examples:

Create a new album:
View an album:

View a single photo:
Site admin home page:

Notice that all functionality is funneled through a single .aspx page (default.aspx in the above examples). The query string contains a "g" parameter that dictates what action is taking place on the page. There will be backwards compatibility with your existing links to albums and media objects. So, for example, a link you may have today that points to a photo at will continue to point to the same photo in 2.2. However, bookmarks to any task or admin pages will not work in 2.2.

I am working on this every day, and as always I love to hear your feedback.

Thursday, October 30, 2008

Multilingual Capabilities in Gallery Server Pro

A great deal of work has gone into making Gallery Server Pro capable of displaying text in multiple languages, and I thought I would give an overview and finish up with a call for volunteers to assist with translating into other languages.

When a user navigates to a web site, most web browsers automatically send the user's preferred language to the web server with the request. Gallery Server Pro uses this setting to automatically return a web page to the user in that language. If no translation has been provided for that language, the default resource - English - is used.

For example, an English user might see a gallery like this:


Another user in the Netherlands, whose browser is set to the Dutch language, can view the same gallery and see the resources in Dutch:


A single installation of Gallery Server Pro automatically provides the correct language, without any intervention by the user. You do not need to choose one language for everyone, nor do your users need to click a special link to read the version in their language. How cool is that!

Be aware that some text in your gallery cannot be automatically served in different languages. This includes any text that is directly editable by an administrator, such as album titles and summaries, and media object titles. It is expected that you edit them directly in your preferred language.

Gallery Server Pro ships with English resources by default. Support for additional languages is provided in language packs which can be downloaded in the Language Translation forum. Deploying a language pack is as simple as copying a few files into the web application. And you can deploy as many packs as you like.

At the moment there is only a Dutch translation and a partially complete Spanish translation, and they are for an older version of Gallery Server Pro. But that is about to change, as I have just finished putting together a process that makes it very easy for volunteers to translate text into their language. I am providing a utility called the Zeta Resource Editor that lets you open two resource files side by side. To create a new translation, make a copy of the English resource file and name it according to your language. For example, the Dutch version of GalleryServerPro.resx is Then you open both files in the Zeta editor:


The two files are merged into a single grid where you can easily compare the two languages. Edit the column to contain the translation for the text in the column to its left (GalleryServerPro.resx). That's it. No messing around with the underlying XML or that primitive resource editor in Visual Studio.

After an initial translation is complete, it must be updated when new versions of Gallery Server Pro are released. Each resource has a date stamp for when it was last updated. The Zeta editor automatically looks for this date stamp and highlights the resources where they differ. For example, here is a screen shot of the 2.0 version of the Dutch resource when compared to the 2.1 version of the English resource:


The yellow, green, and salmon colored cells indicate a resource that must be updated. As you update each one, the background turns white. You know you are done when all the rows are white! (FYI, the first column is always light blue.)

Translators Needed!

Gallery Server Pro is open source and supported entirely by volunteers and donations. If you are able to contribute by providing a translation in your language, we would love your help! As a thank you, I will send everyone who submits a complete translation a copy of the Dilbert book Casual Day Has Gone Too Far.

To get started with a translation, check out the Getting Started thread in the Language Translation forum.

Monday, October 27, 2008

Gallery Server Pro Version 2.1.3222 Released

This is a minor bug fix release. It contains three bug fixes:

  • (SQL Server only) Error when installing to a SQL Server database that uses a case-sensitive collation
  • Wrong resource name used in edit album popup window (only affects non-English translations)
  • Hidden files are added to the gallery during a synchronization. The synchronization code now inspects the hidden file attribute and ignores all hidden files.

Thanks to forum member KiloMike for helping identify the collation issue. This affects only SQL Server users. I had C# code and SQL in stored procedures that referred to column names that differed only by case, such as AlbumId and AlbumID. That works fine when you are using a case-insensitive collation, which is the default, at least on every installation I have ever done. But this fails in case-sensitive collations, such as SQL_Latin1_General_CP1_CS_AS. As I researched this bug, I also found an issue with the database configuration SQL script. I had originally used Visual Studio Database Edition to produce the SQL that configures the database, and it specifies the SQL_Latin1_General_CP1_CS_AS collation. That has always bothered me, because it just didn't seem right to hard code something so culture-specific. Today I discovered that I could replace these references with "COLLATE database_default", causing it to inherit the collation of the database.

Some of you will have no idea what I am talking about. No worries. The end result is that GSP will now install in more situations and you have the option of enforcing case sensitivity if you want. So, a gallery search for 'Summer Vacation' is different than 'summer vacation'. Again, I am still talking about SQL Server only. SQLite ignores case, and I am not aware of a way to change this (but I admit I haven't looked into it, either).

Finally, there is a change in how GSP synchronizes files. Starting with this release, if it encounters a file with the 'hidden' file attribute, it now ignores it. That will help with Apple OS-X users. Thanks to Ralf from Germany for this suggestion.

Instructions for upgrading are - as always - in the Administrator's Guide.

Sunday, October 19, 2008

Gallery Server Pro Version 2.1.3213 Released

I released another set of bug fixes for Gallery Server Pro. The most important of these is fixing the Silverlight issue in Firefox 3. As you may recall, while video and audio played fine in Firefox 2, it worked only intermittently in Firefox 3. The code I used was based on Silverlight 2 Beta 2, and Silverlight finally went RTM last week. I downloaded it and extracted the two javascript files from System.Web.Silverlight. That, combined with a little tweaking of the ScriptTemplate in galleryserverpro.config, and I was able to get it rock solid! Wa HOO!

The only remaining limitation with Silverlight is that it does not accept media objects streamed from the ASHX handler that GSP uses for all images, audio, video, and other media objects. When you try, you get an empty player and the Play button doesn't do anything. I will be working with Microsoft to get to the bottom of this. Meanwhile, your Silverlight templates in galleryserverpro.config must use the replacement parameters {MediaObjectAbsoluteUrlNoHandler} (for when your media objects directory is within the web application) or {MediaObjectRelativeUrlNoHandler} (for when your media objects directory is outside the web application). Do not use {MediaObjectUrl}.

There are no database changes in this release, and instructions for upgrading are - as always - in the Administrator's Guide. Here is a list of the remaining changes and bug fixes:


  • Updated to version 2008.2 SP1 of ComponentArt Web.UI
  • Updated to version of System.Data.SQLite.dll

Bug fixes

  • Silverlight works intermittently in Firefox 3
  • Navigation error when one or more objects in album are deleted by another user
  • NullReferenceException when browsing gallery
  • Permission error when searching gallery
  • Cannot remove user from role
  • Installer does not update provider names
  • Error when logging out of my account page
  • Image metadata items added twice
  • Misleading message during a SQL Server installation

Thursday, October 2, 2008

Gallery Server Pro Version 2.1.3196 Released

Yesterday I released several bug fixes for Gallery Server Pro and updated a couple third party components. Instructions for installing and upgrading can be found in the Administrator’s Guide.

The most important fix was to address a problem with video and audio not playing in the Silverlight plug-in. When I released the Silverlight feature in August, I had tested it extensively on my internal network and, with the exception of some issues with Firefox 3, it worked great. However, after the release it became apparent that the plug-in did not work in many situations. A blue box would appear, indicating that the Silverlight control was instantiated, but the video never started.

In Gallery Server Pro, all media files – photos, video, etc – are served through an ASHX handler. This provides added security and fine tuned control over how the media is streamed to the browser. Unfortunately, the Silverlight plug-in is not behaving well with the handler, and as best I can tell the issue is with Silverlight and not the handler (when in doubt, blame the other guy, right?).

The browser requires Silverlight 1.0 or higher, but I am using javascript and a player that is distributed with the Silverlight 2.0 Beta 2 Developer Tools. When Silverlight 2.0 goes gold, I will get the latest files and try again. If it still doesn’t work, I’ll contact Microsoft for some assistance.

Meanwhile, there is an easy workaround that is implemented in this release – link directly to the media file instead of using the handler. The way to do this is to open ~/config/galleryserverpro.config and replace {MediaObjectUrl} with {MediaObjectAbsoluteUrlNoHandler} for each of the templates where Silverlight is specified (there are four). If you need more help, there are additional directions in the upgrade section in the Admin Guide. If your media objects directory is outside the Gallery Server Pro web application, you must use {MediaObjectRelativeUrlNoHandler} instead.

You may be wondering about my statement that the ASHX handler provides additional security. When you don’t use the handler, your users can view the HTML source and see something like this:


Anyone can copy this URL and use it to access your video any time they want. IIS happily serves the video without checking with ASP.NET (and the Gallery Server Pro user security model) to make sure the user is allowed to see it. I should note that there is a new feature in IIS 7 where you can restrict access to static files like wmv, but this feature does not provide access to the Gallery Server role/user security so it is not a viable solution.

If you are allowing anonymous users access to your gallery, then you don’t have anything to worry about, because you are not trying to restrict them anyway. I say this more as an FYI to those of you who lock down the gallery to restrict access to only logged-on users. And even then an anonymous user can get at your video only if they can guess the URL.

The Silverlight plug-in still does not reliably work in Firefox 3. Sometimes it plays the video; sometimes it doesn’t. Due to the intermittent nature it may be some kind of javascript timing issue. Microsoft has stated they will offer full support with the 2.0 release. I will keep an eye on this and release updated code as soon as I can.

This release also includes an updated version of the SQLite dll and the just-released 2008.2 ComponentArt Web.UI release. Gallery Server Pro uses many of the CA controls for enhanced UI functionality, including uploading files, the menu, tabs, and grids. Unfortunately, the new release still doesn’t fix an issue where the Add objects page becomes unusable after an upload is aborted, either through clicking Cancel during an upload or after the Upload control aborts an upload because the file exceeds the maximum limit. I am working with them to get a fix.

Below is the full list of bug fixes. If you are bored, you can read a detailed report of the bug fixes.

  • Silverlight media does not play with ASHX handler
  • Silverlight media not playing when %2b is in URL query string
  • Media objects are added in reverse order
  • Hard coded English text in web pages
  • Width and height properties not updated when small images are rotated
  • SQLite provider does not delete related data
  • Incorrect SQL in SQLiteProfileProvider
  • Records associated with anonymous users are not removed
  • SQLite DataReader closes connection during transaction
  • Web.config has <machineKey ...> element
  • Error occurs when creating an album with an empty name
  • Calendar popup appears behind edit album dialog
  • User is allowed to add an empty external object
  • SQL Server password accidentally set to encrypted
  • Invalid password attempt count too low
  • Null reference exception when session and profile are null

Monday, September 29, 2008

Gallery Server Pro Ad Campaign Started

Today I started an ambitious ad campaign with Google and Kanoodle. Until today, the only marketing I have done are press releases and general SEO techniques. I don’t think the press releases have done much, but the SEO has worked reasonably well. The popularity of Gallery Server Pro continues to grow every month, and the latest stats show about 25,000 unique visitors per month. There is potential for much more, and I believe Gallery Server Pro has the stability, robustness, and features to justify laying out cold, hard cash to bring in more users.

I continue to work full time on Gallery Server Pro. Your support – through donations – is greatly appreciated and is what makes this whole thing work. I thank you from the bottom of my heart.

Tuesday, September 23, 2008

Gallery Server Pro Architecture White Paper

CodeProject has published an article I wrote describing the architecture of Gallery Server Pro. I first wrote it for the 2.0 release several months ago, but just updated it for 2.1. It has been very popular, with over 90,000 views and an average rating of 4.6 out of 5!

If you are interested in a behind-the-scenes look, check it out. I describe several of the software patterns, including the composite and strategy pattern. In addition, I describe the HTML rendering model and the data provider infrastructure. There is also a section that describes the image metadata extraction technique.

Thursday, August 28, 2008

Version 2.1 Released!

I am pleased to announce the immediate availability of Gallery Server Pro 2.1. There are several new features and a couple dozen bug fixes.

The most important new feature is the use of the open source SQLite database engine for storing gallery data. SQLite is a self-contained, serverless, zero-configuration, transactional, ACID compliant SQL database engine. That is a mouthful, but it can be summed up as “It rocks!”. In fact, you are probably already a SQLite user, as it is the most widely deployed SQL database engine in the world. It is embedded in various Adobe products, Mozilla Firefox, and even in the Apple, Solaris, and Symbian operating systems.

The beauty of SQLite – at least as far as Gallery Server Pro is concerned – is that there is nothing extra to install. The data reside in a file named galleryserverpro_data.sqlite in the App_Data directory of your web application. GSP communicates with the database using System.Data.SQLite.dll, which is a .NET wrapper around the sqlite3.dll C library. This .NET wrapper greatly simplifies the coding, and I owe a great big thanks to its creator, Robert Simpson, at

During installation, you no longer have to mess with SQL configuration settings. The wizard asks you which database engine you want to use – SQLite or SQL Server. If you choose SQLite, then you enter the username and password you want to use for GSP administration, and you are done! Ba-da-boom, ba-da-bing!

SQL Server is still a first-class component, including SQL Server 2008 and SQL Server 2008 Express. You may want to use SQL Server if any of the following are true:

  • You are comfortable with SQL Server.
  • You are already using SQL Server and want to keep all your data in one place.
  • You are forced to run Gallery Server Pro in a Medium Trust environment and are not able to install System.Data.SQLite.dll in the Global Assembly Cache (GAC).
  • Your installation of GSP is mission-critical and you don’t want to take any chances with your data. Since SQLite is file-based, there are rare circumstances where the hard drive reports to the software that the data is written to disk, when in fact it has not yet done so. If, at this moment, your PC loses power, SQLite will think the data is safely stored, but it is not.
  • You are already using ASP.NET membership and have your users in SQL Server. For example, you may have DotNetNuke installed and want GSP to use the existing user accounts in your SQL Server DotNetNuke database.
  • You have other applications besides the GSP web application interacting with the data file. You may encounter file locking issues and slowed performance as multiple threads wrestle for access to the file. This is one of the few cases where a traditional client-server database such as SQL Server is clearly superior.

I believe the vast majority of you will find SQLite to be the best option, and there are a good number of you who wouldn’t consider using GSP before because you didn’t know a darn thing about SQL Server, and didn’t have the time or inclination to learn yet another thing. Now, you don’t have to know anything about SQLite, because it “just works”.

The second major feature is the use of Microsoft’s Silverlight plug-in to render wmv, wma, mp3, asf, and asx files. For example, here is Silverlight being used for an asf video:


You can start playing the video as soon as a few seconds are buffered. Previously, GSP typically rendered videos in an <object …> tag and let the browser figure out what plug-in to use. The plug-ins that I tended to have on my browsers always wanted to fully download the video before starting to play it, meaning you were often twiddling your thumbs. The old functionality is still available if you want (just edit the templates in galleryserverpro.config), but I believe most of you will appreciate the consistency and added features of Silverlight, especially as the plug-in becomes more widely installed.

If Silverlight is not installed on a user’s browser, a Microsoft-supplied image will appear that says Get Silverlight. When clicked, the user is shown a download page and stepped through the process of installing it. You have probably already seen this image on other sites that use Silverlight.

GSP also allows you to point to media objects stored on other servers. For example, when browsing videos on YouTube, you may have seen the embed code textbox on the side:


Copy this text to your clipboard and then navigate to the GSP Add objects page. Click the External content tab, and then paste the embed code, like this:


Click Add media object, and your gallery now has a link to the YouTube video! The video is not actually downloaded to your web server. Instead, the video is streamed straight from YouTube to your user’s browser. YouTube pays for the bandwidth! But it *looks* like it is on your server:


A lot of web sites are offering embed code for their videos. A few that I stumbled across are,, and

You can also upload your videos to Silverlight Streaming and link to them from your gallery. Again, the bandwidth is paid for by them, not you.

There are a lot of other new features and bug fixes that I won’t get into detail at the moment. Among them are significant improvements to the synchronization process, performance of very large galleries, and full support for IIS 7 Integrated Pipeline Mode.

I am proud of the new release, and I hope you enjoy it. If you have any questions, comments, or feature requests, please use the forums.

Friday, August 15, 2008

Version 2.1 Beta Released!

After many months of hard work, I am pleased to release the beta of version 2.1. It contains a few dozen bug fixes and several new features.

Download it here.

The most significant change is the use of the open source SQLite database engine to store the gallery data. SQLite is the most widely deployed database in the world and is embedded in products such as Firefox. All gallery data is now stored in a file named galleryserverpro_data.sqlite in the App_Data directory of the web application. SQLite does not have to be installed prior to installing Gallery Server Pro. All you need is a couple DLL’s in the bin directory and the .sqlite file containing the data, all conveniently packaged with Gallery Server Pro.

This should address one of the biggest headaches you experience with Gallery Server Pro – messing with SQL Server. SQL Server is an excellent client-server database, but it can be difficult to understand and configure. Furthermore, many hosting companies charge more for SQL Server.

SQLite is ACID-compliant and very fast - in many cases even faster than SQL Server. However, if you have several applications accessing the Gallery Server Pro database (that is, high concurrency), you cannot beat a traditional client-server database such as SQL Server. For those situations, Gallery Server Pro still supports SQL Server, including SQL Server 2008.

The only downside to SQLite is that it must run in a Full Trust environment, so some hosting companies – GoDaddy comes to mind – unfortunately cannot use SQLite.

New Features

  • SQLite is the default data store. Users can still use SQL Server if they wish.
  • Data backup and restore functionality.
  • Support for media objects hosted elsewhere, such as YouTube videos and Silverlight Streaming.
  • The Silverlight plug-in is now the default player for wmv, wma, mp3, asf, and asx files.
  • Language resource files have been consolidated into fewer files, which will make translation a bit easier.
  • Improved Add objects page, including better support for IIS 7.0 Integrated Pipeline Mode.
  • Improved performance for very large galleries. Performance tweaks allow Gallery Server Pro to run very fast even for galleries with hundreds of thousands of media files.
  • Increased robustness of synchronization process.
  • Support for SQL Server 2008

Bug Fixes

  • Synchronizing video and audio files does not update the original width and height values
  • Apostrophe in filename causes thumbnail to not render on rearrange page
  • Poor performance of manage users page when there are thousands of user
  • IE not caching images on the client
  • Install wizard does not show any databases in its dropdown list in certain hosting environments
  • Image metadata is sometimes extracted as the text "System.Int64[]"
  • Code references absolute URL when relative URL is sufficient
  • An album title with a trailing period or space causes an exception
  • Page times out when copying large numbers of objectsOut of memory when adding very large images
  • Objects added to a private album may incorrectly appear in search results
  • File lock not released for some files
  • Incomplete error information if an exception occurs when adding a user
  • Adding a user sometimes never returns from "Communicating with server..." message
  • Cannot manage users with ActiveDirectory provider
  • Album stats count hidden albums
  • URL occasionally incorrectly calculated when installed as root application
  • User cannot change password if e-mail functionality is not configured
  • User cannot change e-mail address on account
  • Certain images that previously synchronized fail during subsequent synchronizations
  • Dialog window with the text "true" appears when clicking the Show metadata toobar icon
  • Error during app startup if a role in gs_Role and aspnet_Roles differ only by case
  • Timeout error for very large galleries (> 40,000 albums)
  • Receive InvalidMediaObjectException during synchronization
  • Message not cleared after logging in
  • Thumbnail / optimized images sometimes created with wrong width/height
  • User does not receive friendly message when Gallery Server does not have delete permission to mediaobjects directory

Tuesday, August 5, 2008

Improved video handling in 2.1

It looks like Firefox will support the <video> tag in 3.1, due in 2009. It will join Opera, which already supports it. That is good news. Unfortunately, Internet Explorer 7 does not support it, and it doesn’t look like IE8 will either. Until all the major browsers support a standards-based approach, playing video in browsers will continue to be a challenge.

The current state of rendering video in browsers is pitiful. Browsers require a plug-in to play video, and web developers are not guaranteed that one is installed. The Flash plug-in is the most popular, and most video sites, like YouTube, convert their video to Flash format and embed it in a custom wrapper that offers play/pause and other functionality.

Gallery Server Pro uses the Flash plug-in for swf files, so if your animation or video is in this format, you are good to go. But Gallery Server can’t take your mpeg or wmv file and wrap it up in Flash for you. I believe there are ways to do this using open source converters, but it is not trivial to implement. If someone wanted to volunteer some time to add this, I would be happy to include it in a future release.

So what do you do when you want to post your videos in their native format, whether it is mpeg, wmv, mov, avi, or some other format? Or, more specifically, what should Gallery Server Pro do when you upload one of these videos? Should it assume a particular plug-in is installed? Should it convert everything to Flash?

There are pros and cons to each potential solution, and in the end I came up with a flexible HTML template system that provides a default solution, but allows you – the web administrator – to change it to conform to your needs. For example, version 2.0 will output the following HTML for most videos:

<object type="{MimeType}" data="{MediaObjectUrl}" style="width:{Width}px;height:{Height}px;">
  <param name="src" value="{MediaObjectUrl}" />
  <param name="autostart" value="{AutoStartMediaObjectText}" />

This produces XHTML 1.1 Strict syntax that lets the browser decide how to render it. If a plug-in is installed that can handle the MIME type, then it is used. If no plug-in is available, the browser may – or may not – give you some help in choosing and installing one.

This approach works reasonably well in current browsers, but older ones don’t handle the <object> tag very well. If backwards compatibility is more important than conforming to web standards, you can edit the template to use the <embed> tag. You can read more about this in the Admin Guide.

The introduction of Silverlight adds new possibilities, and the upcoming release of 2.1 will have new templates that use the Silverlight plug-in for wmv, wma, asf, asx, and mp3 files. One of the greatest benefits to the Silverlight control is the ability to start playing video once a few seconds have been buffered. Most plug-ins I had previously tested play the video only after it has been completely downloaded. So far this feature is working nicely, but I have been struggling with some issues with Firefox 3. It’s been a real cat and mouse game in figuring out the guilty party; I don’t know whether to blame Silverlight, Firefox, or the ComponentArt ASP.NET controls.

Probably the most robust and reliable way to play video in Gallery Server is to use the new External Content feature of version 2.1, and I am really happy with how this is working out. With this release, you add a media object to the gallery, *not* by uploading a file, but by pasting HTML code that refers to the media object hosted elsewhere. For example, every video on YouTube has embed code you can copy. It looks something like this:

<object width="425" height="344">
  <param name="movie" value=""></param>
  <param name="allowFullScreen" value="true"></param>
  <param name="WMODE" value="opaque"></param>
  <embed src="" type="application/x-shockwave-flash" allowfullscreen="true" wmode="opaque" width="425" height="344"></embed>

The Add objects page in Gallery Server Pro now has two tabs: Local Media and External Content. The Local Media tab works like before, where you can upload media files to the gallery. The External Content tab allows you to paste the embed code, as seen here:

Add objects screen shot

When you view this media object, Gallery Server Pro embeds the HTML fragment as part of the entire page, where it will play the video directly from YouTube. The beauty of this approach is you get the benefits of YouTube’s technology for converting video and buffering content. Also, YouTube pays for the bandwidth. The video never actually passes through the web server Gallery Server Pro is running on.

You aren’t just limited to YouTube. You can also use Silverlight Streaming to host your video files, or add your favorite The Daily Show clips from Comedy Central. In fact, any HTML can be used. This is a powerful new feature, and I am sure some people will find applications for it that I haven’t even imagined.

Saturday, July 19, 2008

The blog is re-born

Two months ago I added a blog to Gallery Server Pro by first creating a blog on Windows Live Spaces and then adding a web page that displayed the blog posts by retrieving the RSS feed. It was quick and easy, but had a fundamental problem: There was no easy way to retrieve blogs by ID or date range, so the page showed all the posts. I also could not display the titles for the most recent posts in a sidebar with a link to each one. I could have hacked a way to do it but surely there is an easier way.

The easier way was to switch to a different blog engine. So now I have a blog with Blogger, which is owned by Google. It has a rich API for querying blogs through a URI and better documentation. I don't want to spend a lot of time getting this blog working - I would rather spend my free time on Gallery Server or my five-month old son Skyler.

Now each blog entry is accessible with a specific URL, so I don’t have to tell you in the forum to scroll down to the blog entry on such and such a date to see the roadmap. I can just give you the link.

UPDATED 2008-07-25: While I was at it, I also added comments functionality. You post your comment using the Blogger web site, and I display them with the post. It is nice because we enjoy the benefits of comments but I don’t have to mess with the UI for adding them, especially CAPTCHA’s.

Monday, May 26, 2008

Gallery Server Pro API Documentation Released

I have been adding XML comments to my C# code for almost as long as I have been using C#. XML comments are a great help as you code, because they show up in Intellisense to remind you about important details of your methods and properties.

But until now, I have never gotten around to building a help document from those comments. Well, that time has finally arrived. I spent the last few days playing with Sandcastle and the Sandcastle Help File Builder. Most of that time I spent going through all my comments and adding tags and filling in a few missing comments here and there.

If you are a developer modifying the Gallery Server Pro source code, this document can help you wrap your head around the namespaces and classes.

Download the Gallery Server Pro API Documentation. Note: You may have to unblock the CHM file. If the file does not display content, right-click the file, choose properties, and then click Unblock.

Tuesday, May 20, 2008

How To: Integrate Gallery Server Pro with Active Directory

You can configure Gallery Server Pro to use your existing accounts in Active Directory. Woo HOO! Crack open the Skittle-brau and pretzels!

Gallery Server Pro uses the ASP.NET Membership Provider model to manage users and roles. By default, it is configured to store this data in a SQL Server database. However, you can take advantage of an entirely different data store through the use of alternate membership providers such as ActiveDirectoryMembershipProvider or even one you write yourself. In this article I'll describe how to modify a default installation of Gallery Server Pro to use Active Directory for user management.

Note: Due to differences in behavior between SqlMembershipProvider and ActiveDirectoryMembershipProvider, a few tweaks to the code behind for the Manage Users page is required. These changes will be included in the next release. Until then, you can replace the contents of manageusers.aspx.cs with this version (you'll need to recompile).


Step 1: Configure basic AD integration

The first step in Active Directory configuration is to modify the web.config file in the root of the Gallery Server Pro application. Add a connection string to AD:

    <add name="GalleryServerDbConnection" connectionString="Data Source=(local);Initial Catalog=GalleryServerPro2;Integrated Security=true;Application Name=Gallery Server Pro" />
    <add name="ADConnection" connectionString="LDAP://,DC=mydomain,DC=techinfosystems,DC=com"/>

The value is the IP address of the domain controller. You can also specify the Fully Qualified Domain Name (ex., the Relative Distinguished Name (ex. godzilla if that is the name of your DC); or for more redundancy you can specify just the domain name (ex. mydomain).  Which ever you choose just be sure you can ping it.

The next step is to comment out the existing membership configuration by adding <!-- to the beginning and --> to the end, like this:

<!--<membership defaultProvider="SqlMembershipProvider">
    <add applicationName="Gallery Server Pro" connectionStringName="GalleryServerDbConnection" minRequiredNonalphanumericCharacters="0" minRequiredPasswordLength="2" requiresQuestionAndAnswer="false" passwordFormat="Clear" enablePasswordReset="true" enablePasswordRetrieval="true" requiresUniqueEmail="false" maxInvalidPasswordAttempts="50" passwordAttemptWindow="10" name="SqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider"/>

Now add the new membership info for Active Directory:

<membership defaultProvider="AspNetActiveDirectoryMembershipProvider">
    <add name="AspNetActiveDirectoryMembershipProvider"
          type="System.Web.Security.ActiveDirectoryMembershipProvider,System.Web, Version=,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a"

The version number must match the one installed on your web server, so update it as needed. Some examples I saw on the internet used 2.0.3600.0 instead of Make sure the connection string name matches the name you specified in the connection string definition. The enableSearchMethods attribute is required so that Gallery Server Pro can retrieve a list of all users on the user management page.

Now, at this point you should be able to log on to Gallery Server with your domain account, but you will receive the following message:


This is because your user account is not a member of any roles in Gallery Server Pro. Recall that when you installed Gallery Server Pro, a role named GlobalAdmin was created with administrative permission. Now you need to add one or more AD users to this role. But how do you do this when no one has authorization to perform this task?

If you are using IIS 7, the answer is easy. Open up IIS Manager, navigate to the Gallery Server Pro web app, and click .NET Users. A list of your AD users appears. Double click the one that you want to be the administrator, and add the user to the GlobalAdmin role in the dialog box. The next time you log on to Gallery Server Pro you will have administrative access.

For IIS 6 and earlier users, the task is a bit more difficult because those versions don't provide a means for accessing the users. However, all versions of Visual Studio 2005 and higher - including the free Express versions - provide the Web Site Administration Tool, which allows you to edit the roles for users. Using this tool is beyond the scope of this document, but online information can be found.

At this point you should be able to log on using your AD account. Use the syntax user@fully_qualified_domain_name, such as Later I'll show you how can get change it to just the username.


Step 2: Create, edit and delete AD accounts within Gallery Server Pro

Once you are logged on as an administrator, you can go to the Manage Users page and add the remaining AD accounts to appropriate roles. If the IIS user account does not have permission to make changes to AD, you may receive an error like this when you click Save changes:


You will get this error because the IIS worker process does not have permission to modify AD data. To get around this, you have two choices:

1. Specify a domain account in web.config that has the necessary permission. Open web.config and add connectionUsername and connectionPassword attributes to the provider definition, like this:

<membership defaultProvider="AspNetActiveDirectoryMembershipProvider">
    <add name="AspNetActiveDirectoryMembershipProvider"
      type="System.Web.Security.ActiveDirectoryMembershipProvider, System.Web,Version=,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a"

Note that putting an AD account name and password in a plain text file is a security risk. If you go this route, I HIGHLY recommend you encrypt the web.config file. Here are two links where you can learn more:

How To: Encrypt Configuration Sections in ASP.NET 2.0 Using DPAPI

Video: How Do I: Encrypt My Web.Config File?

2. Specify an account for the IIS worker process that has the necessary AD permission. I prefer this over the first solution.

Once the permissions are sorted out, you have the potential to create, edit and delete users. Remember that adding a user creates a new account in Active Directory and deleting an account removes it! Obviously this can be abused in a way that affects your entire domain, so use caution. For this reason, you may actually prefer to revert to read-only permissions and handle role membership via IIS 7 Manager (or the Web Site Administration Tool for IIS 5-6).



Log on with simple username instead of fully qualified name

Your users might not be thrilled with to have to log on with the syntax user@fully_qualified_domain_name, such as If you want to log on with just a username, add the attributeMapUsername to the membership configuration:

<membership defaultProvider="AspNetActiveDirectoryMembershipProvider">
    <add name="AspNetActiveDirectoryMembershipProvider"
      type="System.Web.Security.ActiveDirectoryMembershipProvider,System.Web, Version=,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a"

By setting attributeMapUsername to sAMAccountName, you can log on with just the username, such as 'Roger' in the previous example.

Additional provider options

The AspNetActiveDirectoryMembershipProvider provider includes several attributes I haven't mentioned. These attributes configure various logon and password options. Be sure to check them out if you want more control.



Can't use Windows groups

If you are using AD, you probably use Windows groups to control permissions. You may have a Marketing group whose members have read/write access to the marketing shared folder but read only access to the Development and Engineering folders. Wouldn't it be nice if you could map albums in Gallery Server to your groups, so that the Marketing users would have control over the Marketing album, Developers have the Dev album, and so on?

On the surface, it seems we can just use the WindowsTokenRoleProvider instead of the SqlRoleProvider. However, if one tries this, the following error occurs during application startup:

"The configured Role Provider (WindowsTokenRoleProvider) relies upon Windows authentication to determine the groups that the user is allowed to be a member of. ASP.NET Role Manager cannot be used to manage Windows users and groups. Please use the SQLRoleProvider if you would like to support custom user/role assignment."

This error is generated when Gallery Server Pro tries to get a list of all roles with the Roles.GetAllRoles() method, and the WindowsTokenRoleProvider does not support it. Unfortunately, Gallery Server cannot do its job unless it can get a list of the roles, so for the time being we cannot take advantage of the Windows groups. If anyone discovers a way around this, let us know.

Can't auto-logon users

Back in my classic ASP days I built an intranet app that automatically recognized the Windows account the user was logged on with. No separate logon inside the web app was required. For reasons I don't understand, I cannot accomplish the same thing with ASP.NET Membership. Sure, you can disable anonymous authentication, enable Windows authentication, and turn on impersonation in web.config. Doing this *does* allow Gallery Server Pro to automatically log on users, but it doesn't think the user is in any roles, and there doesn't seem to be any way to configure roles for the user. Let us know if you know a way around this.

Can't reset or change password on other accounts

I didn't spend much time investigating this, but it appears you can't use Gallery Server Pro to reset or change another user's password. I received error messages when I tried. You *can*, however, change your own password by clicking the My account link in the top right corner and then clicking Change password.

Thursday, May 15, 2008

Gallery Server Pro Roadmap

I recently put together my development roadmap and wanted to publish it to keep everyone in the loop. Many of the new features came from your suggestions in the Features Request forum. Keep 'em coming!

There are no guarantees that I will stay on schedule or that the final features and bug fixes will match what I have here, but this is my best guess at the moment. I welcome help from anyone who wants to lend a hand - feel free to tackle any of these issues or brainstorm your own improvements. Just make sure you coordinate with me so we don't step on each other's toes.

The number by each item is my internal tracking number. Refer to this if you contact me about one of them.

Version 2.1 (due August 2008)

New features

  • Create SQLite provider and make it the default data store. This removes the dependence on SQL Server and will greatly simplify the installation process as well as reduce hosting costs. Users can still use SQL Server if they wish. (#81)
  • Enable data backup and restore functionality. This will allow easier migration from one server to another as well as between SQL Server and SQLite. (#50)
  • Add support for playing video and audio with Silverlight, including those hosted on Silverlight Streaming. (#77)
  • Add support for playing videos hosted on YouTube. (#78)
  • Consolidate language resource files into the minimum possible number of files. This will allow for easier translation. (#80)
  • Allow real-time feedback of upload progress under IIS 7.0 Integrated Pipeline mode. Currently it works only in IIS 6 and IIS 7 Classic mode. (#83)
  • Make it easier for users to financially contribute to Gallery Server Pro. (#84)
  • Ability to run under .NET 3.5 without MS Ajax 1.0 installed. (Not sure if this is possible without switching to requiring the .NET 3.5 runtime, which I am not going to do.) (#85)

Bug fixes

  • Adding an album to a parent album that has just been deleted causes InvalidAlbumException. (bug# 78)
  • Synchronizing video and audio files does not update the original width and height values. (bug# 80)
  • Image metadata is sometimes extracted as the text "System.Int64[]". (bug# 87)
  • An album title with a trailing period or space causes an exception. (bug# 90)
  • Fade effect causes white specs in black areas of photo in IE. (bug# 91)
  • Cannot manage users when passwords are encrypted. (bug# 94)
  • Out of memory error when adding very large images. (bug# 95)
  • Apostrophe in user name or role causes edit user/edit role dialog failure. (bug# 97)
  • File lock not released in certain circumstances (bug# 98)
  • Incomplete error information if an exception occurs when adding a user (bug# 99)
  • Adding a user sometimes never returns from "Communicating with server..." message (bug# 100)
  • Cannot manage users with ActiveDirectory provider (bug# 101) (See thread for workaround.)
  • Album stats count hidden albums (bug# 102)
  • URL occasionally incorrectly calculated when installed as root application (bug# 103)
  • User cannot change password if e-mail functionality is not configured (bug# 104)
  • User cannot change e-mail address on account (bug# 105)
  • Certain images that previously synchronized fail during subsequent synchronizations (bug# 106)
  • Dialog window with the text "true" sometimes appears when clicking the Show metadata toobar icon (bug# 107)


Version 2.2 (due December 2008)

New features

  • Wrap Gallery Server into one or more user controls. This will allow much easier integration of Gallery Server Pro into existing web sites. (#92)


Version 2.3 (due 2009)

New features

  • Add virtual album support (# 90)
  • Increase robustness of synchronization (# 111)
  • Add more sorting options (# 91)
  • Allow metadata to be edited (# 89)
  • Allow users to comment on media objects (# 95)
  • Allow users to self register user accounts (# 96)
  • Retain log of web errors that can be reviewed in Site Admin area (# 97)
  • View log of user and gallery activity (# 98)
  • Allow album ownership as an alternative to role-based access (# 99)
  • Make it easier to view relationship between users and roles (# 102)
  • Add checkbox on "Delete hi-res images" page to allow recursive deletions (#8)
  • Add quota per user (#27)
  • Fix unintuitive checking/unchecking of albums in treeview (#28)
  • Let user see album view while viewing individual media object (#33)
  • Provide option to discard original image during upload (#36)
  • Improve upload progress bar to include zip file extraction progress (#38)
  • Make thumbnailPath and optimizedPath optional fields in galleryserverpro.config (#48)
  • Allow user to specify media object location during install wizard (#51)
  • Add a config setting that controls the "Remember Me?" checkbox on the login page (#52)
  • Tweak the spacing on the Password tab in Edit User dialog (#53)
  • Allow album date start, date end, date added, date last modified to be searchable (#58)
  • Allow deleting multiple albums from the Delete objects page (# 66)
  • Allow paging of thumbnails on album view page (#70)
  • Allow install wizard to install a second gallery in same database (# 71)
  • Allow relative references to outside the web folder for media objects (# 72)
  • Add option so user always downloads original image rather than displayed image (# 73)
  • Do not include file extension in caption when using filename in media object caption (# 74)
  • Prevent user from specifying a subfolder of the media objects directory for thumbnails/optimized. (# 75)
  • Extract thumbnail image from Shockwave Flash file (# 79)
  • Decrease time it takes to delete albums and media objects (# 86)
  • Allow user to download multiple objects in a single ZIP file (# 87)
  • Add additional information to metadata list, such as file name, file size, data uploaded, etc. (# 88)
  • Extract GPS coordinates from media objects and offer mapping service (# 94)
  • Add slide show duration setting to Site admin section (# 100)
  • Add ability to view recently added media objects (# 105)
  • Improve workflow of assigning thumbnail image (# 106)
  • Add ability to start a slide show from the album view (# 109)
  • Add role permission "Edit child albums" (# 110)


Version X.X (who knows when I can get to this)

  • Create client utility that provides an improved UI for copying media objects to server. One feature it could have is to create optimized images on the client and upload those instead of the originals. This could be a great project for one of you developers out there!

- Roger

Wednesday, May 7, 2008

The blog is born

I have wanted to add a blog to this web site for quite a while, but was stymied by the amount of work it would take to code it up. But several weeks ago I read about accessing a blog through an API that is created elsewhere, so I thought I would give it a whirl. I created a blog on Windows Live Spaces and grabbed the RSS feed that it generated. Then I created a web page on with an XmlDataSource pointing to the RSS feed and a Repeater that used the XmlDataSource for its data.

Now I can create blog entries through any means supported by Live Spaces (their web tool, Windows Liver Writer, etc.) and the entry automatically appears on the Gallery Server Pro web site. Cool. I am not sure how to handle comments at the moment or what happens as dozens of entries pile up; let's start with basic blog functionality and go from there.