Slapping Together a Photo Gallery in ASP.NET Part II - My Gallery
(Page 5 of 7 )
In the previous section, I gave you a glimpse of what the final "Photo Gallery" might look like. While I agree that the output will not win kudos on account of its bland user interface, it should have given you a firm grasp of the programming logic that I wish to implement for my "Photo Gallery" application.
But before I proceed further, I would like to refresh your memory by relisting the folder structure introduced in the first part:
E:\inetpub\wwwroot\
+---Gallery
|
+---Australia
| +---Christmas
| \---New_Year
+---London
| \---The_Tube
+---New York
| \---Independence_Day
\---Singapore
\---Shopping_Festival
It is quite obvious that the "Photo Gallery" application assumes the above folder structure is created under the root folder of the Web server, and that proper file system permissions have been assigned to these folders. Furthermore, this two part series primarily aims to demonstrate the file management capabilities of the .NET framework. So, I wouldn't recommend that you host this application in a live environment without a thorough review of the security risks involved.
The bottom line - you've been warned!
Check here for the code listing.
Save this script as "gallery.aspx" in the "wwwroot" folder (as displayed in the hierarchy above). Now, load the script - I can access it using "http://localhost/gallery.aspx" on my local server - in order to view the following output:

Click on the one of the "Photo Albums" to view the "Photos" present in the selected album. Take a look:

Here, I would like to point out that it is possible to have nested "Photo Albums" - after all, they are just file system folders containing image files. Take a look at the following screen shot that displays a "Photo Album", which contains "Photos" as well as nested "Photo Albums":

No "Photos" in a particular "Photo Album" - no sweat, this "gallery.aspx" script is programmed to handle such situations, as seen below:

Now that I have given you a quick walk through of the application, it is time to decipher the code that has brought about this transformation. One look at that code listing and I'll bet that you are definitely not looking forward to the next section.
Well - that’s what I am paid for. So, here goes nothing!
Next: My Gallery - Demystified >>
More ASP.NET Articles
More By Harish Kamath