This project is read-only.

Doesn't display images...

Sep 27, 2010 at 10:29 PM

I've downloaded this plug-in and am trying to get it to work correctly. It does give me a list of the files in my web project, but does NOT display the photos. I get a list of file folders with a 'Click to open "Samples" Samples' message but nothing displays. What am I missing? Also, I do NOT want my users to have to click through several layers of files to view the photo album - how do I get it to go directly to the photo directory without listing everything else as well?

Thanks for any help, it would be appreciated.


Sep 28, 2010 at 1:02 AM

Are you getting any broken images on the page?

To get to a specific folder’s contents directly, there are plenty of settings in there that you can work with, but the easiest is to just drop the handler directly in the folder you want to be the root of your image album.

Sep 28, 2010 at 12:50 PM

Thanks for the response. No - no images at all! I put ALL of the files directly into the "Photos" directory. I use VB.Net to develop in and my directory structure is set up as follows: wwwroot/maindevpages/clientsdirectory/photos. When I run the page what I get is a black background with links along the top "Click to open "Photohandler" and when I do it does not display ANY photos (and I have six of them in the photohandler directory!) Sorry I don't have a link to show you (I have not FTP'd the code to my site yet, I'm still testing on my local host) but what I get is a black screen with this along the top (and you can't read all of the text either): Click to go back to the parent folder Up  Click to display  Click to display  Click to display  Click to display  Click to display  Click to display

I am presuming that the images are just not showing up through the CSS? I will have to make some changes to the CSS any way to make it work with my client's web site, but aren't the images supposed to display on top of the black background? Nothing is displaying - and in order to get to the point where I can click on any of (what I am presuming are the images) displayed across the top, I have to click through the entire directory structure to get to that point! Please, what am I missing? I have not made any changes to the code - I just extracted ALL files directly into my photo directory as per the instructions.

Thanks for any/all help you can give.



Sep 29, 2010 at 4:56 AM

What version is that? The one in downloads? If so, you also need to put the metadataextractor.dll file into the bin directory that is at the root of your web application.

Sep 29, 2010 at 5:08 AM

I thought I downloaded your most recent version - I will check it and see. I noticed that you updated it yesterday, and thought I had clicked on that version to download, but maybe I had started the other one first before I found the updated version.

Hmmm - I'll check it out tomorrow and let you know - it's 10pm here and I've been up since 4am, time for bed in Belize :-)

Thanks very much for your help, I will post tomorrow and let you know if it works or not.

Sep 29, 2010 at 3:34 PM
Edited Sep 29, 2010 at 4:01 PM

It IS the most recent version - AlbumHandler2_1. It includes the MetaDataExtractor.dll in a separate Bin directory, does that Bin directory have to reside in the same "Photo" directory where I extract the rest of the files? I have a Bin directory at the root level for my project, so of course I put any files associated with the Bin into it,but if I need it in the same directory, that could be the problem. Let me try that and I'll let you know if it works...thanks!

Sep 29, 2010 at 4:06 PM

Okay I added the Bin directory directly into the same "Photos" directory where I have all the photo handler files. I now get this error message:

Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0246: The type or namespace name 'com' could not be found (are you missing a using directive or an assembly reference?)

Source Error:

Line 52: using System.Web.UI.WebControls;
Line 53:
Line 54: using com.drew.metadata.exif;
Line 55: using com.drew.metadata.jpeg;
Line 56: using com.drew.metadata.iptc;

Source File: c:\inetpub\wwwroot\maindevelopmentdiractory\ClientsDirectory\Photos\Photohandler\album.ashx    Line: 54

Can you please let me know what I need to do to fix this error?  Your help is greatly appreciated. Thanks!


Sep 29, 2010 at 5:10 PM

No, the bin directory should be at the root of your web application. Probably maindevelopmentdiractory in your case.

Sep 29, 2010 at 6:58 PM

That's how I had it before I moved the entire bin directory to inside the Photo handler directory. So I moved it back and now the page does load, but it STILL loads showing every directory in my project, and I have to click through the entire "tree" to get to the photo directory. When I do, it does NOT ever display the .jpg files it shows on a black background a list of the photos but does NOT display them. I can load it up into my test website and paste a link here if it would help you to see what I mean...

Any help would be so greatly appreciated. Thanks!

Sep 29, 2010 at 7:09 PM

Did you also move the album.ashx file (because you should not)?

Sep 29, 2010 at 7:25 PM

No I did not move anything but the .dll file back to the Bin in the root directory (I removed the bin directory I created under Photo Handler) so here is the exact tree structure for the photohandler directory:


As you can see, the album.ashx is in the same directory with everything else, as it was extracted. I did have to take out the ~/ before the album.ashx in both the default.aspx and the templated.aspx because it IS in the same directory as the photo handler...

Thanks again very much for your help.

Sep 29, 2010 at 7:29 PM

Are you actually using the default.aspx and templated.aspx files?

Sep 29, 2010 at 7:44 PM

I am developing VS2010. To see if it "works" I view it on my localhost by running the photohandler/default.aspx in Firefox. I also copy the url for my localhost into Chrome to test it. In Chrome, I get "image" place holders, but no images, and I STILL get the entire directory listing for my entire project.

I thought it was just supposed to run the photohandler and ONLY "read" the files that are in the same directory with it - thus being why it needs to be in the same directory with the image files... Am I missing something? I'm sorry if I am, I don't see any instructions other than to download it, extract it into your image directory (and obviously to put the .dll in the Bin directory) and that viola~ it is supposed to work. I'd really like to use this - it looks awesome, and and to be honest, I REALLY now want to know how to get it to work correctly! ;-) Thanks!

Sep 29, 2010 at 8:49 PM

First try to hit handler.ashx itself. The default and templated files are just examples of how to use the handler as a control, but if you just want to display the album, you only need album.ashx.

If you are seeing plceholders but no images, right-click on that placeholder, look at properties and copy the URL for that image (or get that directly from "view source"). Then copy that url into a new browser (you might need to complete the url with the base path for the handler). Once you've done that, you should be able to see the exact error message for that image.

Sep 29, 2010 at 10:20 PM

Just running the album.ashx does work - however, I have no idea how to integrate this into my existing web pages, which is why I was using the default.aspx that came with it. Is there somewhere that there are instructions on how to integrate this? I am developing in VB.Net not C# but if they are separate stand alone .aspx pages I know it doesn't matter, but it does matter if I have to learn C# to integrate this into my pages...

Once again, your help is greatly appreciated.

Sep 29, 2010 at 10:26 PM

You can use the handler standalone or as a control in a page, which is what the default.apsx and templated.aspx pages show. When you do that, there are properties you can set on the control to point it to a specific path. For example, try to set the Path property.

Sep 29, 2010 at 11:25 PM

If I just drop it into my existing .aspx page as a user control I'm going to need to do a lot of formatting to get it to look right - which is fine (I will need to change the CSS to match my client's site any way) but I don't understand the code in the .ashx file and really don't want to mess with it - I know just enough to be dangerous - if you know what I mean :-D.

I'll try using it as a kind of user control and see how it works. I honestly did not realize that was how it was designed. My fear is that I'm going to have the same issues as it has with the default.aspx file that came in the download; that none of the images will display. I'll let you know. Sorry I am such a PITA! Thanks for all of your help!

Sep 29, 2010 at 11:30 PM

You might need to also set the HandlerUrl property on the control to point to where you put the album.ashx file.

Sep 30, 2010 at 12:10 AM

Thanks. I'm taking a much closer look at the .ashx file. I am not positive about the code, but I am removing all of the ~/ from in front of the album.ashx file and hope that will work. I was right though - just putting the

<%@ Register Src="album.ashx" TagPrefix="photo" TagName="album" %>

in my test page doesn't work. I have a Masterpage and this is going into the content page. I put it directly under the call to the Masterpage but not in the actual ContentPlaceHolder - and it does not work. I'm trying to understand this, but don't seem to be having much luck.

So I see this section of code:

[DefaultValue("album.ashx"), UrlProperty]
        public string HandlerUrl {
            get {
                string s = ViewState["HandlerUrl"] as string;
                return (s == null) ? "album.ashx" : s;
            set {
                ViewState["HandlerUrl"] = value;

But I don't see where I would put in an actual URL or path. I have now moved the entire set of files directly into my Photos folder so I have my tree set as follows:

                all the photo handler files

In the above code - where do I put the path to the .ashx file and how do I format it in C#?

Sep 30, 2010 at 12:14 AM

Look at the default.aspx sample page. It has the registration for the control AND the server tag. On the server tag, you can add properties.

For example, <photo:album runat="server" ID="Album1" HandlerUrl="~/photos/album.ashx" Path="~/photos/subfolder" />

Sep 30, 2010 at 12:22 AM

Oh! I thought I needed to add the path in the C# code... and I er, -  I don't do C# well enough. I understand some C# but not enough to start programming in it. I do much better with VB or HTML - that makes sense now - thank you! Let me try that and see what I get. :-)

Sep 30, 2010 at 12:30 AM

Woo Hoo! Now that's more like it! Thank you, thank you!

Sep 30, 2010 at 2:18 AM

One last question...

any way to add captions? I see them in the example, and I've been scrolling through the discussions here and on your blog, but I don't see any answers on how to get the captions below the images...

Thanks again so VERY much for all of your help on this, now that I have it working, I love it - Thank you!

Sep 30, 2010 at 3:57 AM

The templated sample shows how to take over the rendering entirely. It's more complex but captions are one of the things you could add with this.

Sep 30, 2010 at 4:12 AM

Thanks. I actually figured out how to get the "Caption" to display. It is complicated, but if you have a graphic/photo editor that adds in the IPTC Metadata then it actually works pretty easily using the template design - thanks for adding that code in it! 

For anyone wanting to know how to do this, I used the templated.aspx and used the above HTML code with my correct path to get the page to display correctly (and I am in the process of changing the CSS and .ashx files to use my client's background colors) but the templated.aspx reads the IPTC metadata inherent in any photo. If the photo doesn't have any, you can actually add it using some photo editors (Photoshop, I use Xara) but I easily was able to add a title to my photos in windows. I just right clicked on the actual photo and updated the properties for it. It HAS to be in the title section, but where you would add any tags, ratings, comments, etc. - that is where you add the title. Then the templated.aspx does the rest!

Thank you so VERY much for all of your help - it is greatly appreciated, and thank you for this great product! Fantastic! ;-)


Sep 30, 2010 at 8:39 PM

I am like so many others and would like to change the thumbnail background color. I've read through all of the other threads on this issue and don't see where the issue was ever resolved. I have already changed everything in my CSS and in the .ashx file and I have tried completely deleting everything in my cache, reloading the images, closing all applications and restarting a even looked it up on Google. I found quite a lot for other photo editors about the thumbnail background color, but nothing that is specific to windows or Microsoft generated thumbnails. Has anyone ever found a fix for this? Thanks again,



Sep 30, 2010 at 8:45 PM

I'll fix this eventually but unfortunately I don't have the cycles right now. In a few weeks hopefully. The BackGround property should be what you need to change. It's being used to draw a background rectangle in CreateNewImage but the equivalent call may be missing from CreateFolderImage.

Sep 30, 2010 at 9:02 PM

Thanks - at least I know it's not just me this time ;-) I looked everywhere through the code and was able to change my regular background color, and other than the thumbnails having black backgrounds, this looks fantastic! I did find one spot in the .ashx code that I think may be where it needs to be changed, but I am not familiar enough with the draw commands to chance changing the code much. It's this bit:

 float borderWidth = thumbnail ? ThumbnailBorderWidth : PreviewBorderWidth;
            g.FillRectangle(new SolidBrush(BackGround), 0, 0, width, height);
where the background is, I thought to add .transparent, but I got an error when I I'll wait until you have time. Sure wish I knew more about C#, or had the time to learn it before I have to finish this site for my client - but I am VERY happy to have the photo album working - thanks again!

Oct 31, 2010 at 8:27 PM

I'm trying to add a photo to the photo album. I thought it would be as simple as adding the .jpg file to the photo directory. I did that and FTP'd it up to my live website, but for some reason, when you scroll through the photos, it does not show up. I know it's there. I've double checked and it reside both in my ASP.Net application and in the correct directory on the hosted server. The photo handlere is not "reading" the new photo. is there something I am doing wrong? TIA,


Oct 31, 2010 at 9:16 PM

Maybe the image is corrupted? Does nothing at all appear, not even a broken image? what's the extension for the file?

Oct 31, 2010 at 11:05 PM
Edited Oct 31, 2010 at 11:07 PM

The file is not corrupted, I can open it just fine with any image viewer, it's a normal .jpg file. It's just odd that  I can open it, view it, edit it (I was easily able to put the title information in it for the caption) and yet it just doesn't display...the other three photos in the directory display just fine - so I don't understand why it's not working...

Nov 1, 2010 at 1:39 AM

Well I have no idea why this isn't working, but here is the link to the live site. Right now there are the original 3 photos displaying, but there should be a 4th. Any other ideas?



Nov 1, 2010 at 6:15 AM

Would you mind sending me that photo? bleroy at microsoft.

Nov 1, 2010 at 2:16 PM

Thank you, I've sent it, I hope I've sent it to the right address :-)

The only thing I can think of is that I did go into the code and try to "Tweak" it a little to get the background color of the thumbnail to change, but it seems very odd to me that it would display the first three photos but not the additional ones. I've added another one for testing purposes to my test site and it doesn't work either...

Nov 1, 2010 at 4:03 PM

Found the problem. The photo had a file extension of .jpeg and would not show. It has to have a file extension of .jpg and then it works perfectly!

Thanks again for your help! I hope that if someone else runs into this problem this will help them.