I have placed a Photo Album on my hosted web server, but the thumbnails of the photos aren't showing up. Originally I placed these files in my root directory because of where the web.config file had to be. But I got an error and couldn't see the page. The files were mixed up with the other files in my root directory which display my portfolio. So then my hosting service set up a subweb for the photo album (megan). Now there are no errors, but you can't see the thumbnails for the photos. It worked on my IIS. Here is the offending page:
There does not seem to be a permissions problem with the photos folder because you can see the pics with a direct link.
Here is how the photos folder works:
photos
2000
Christmas Elf.jpg
Mommy and Me.jpg
2001
etc...
2002
2003
Here is my ASP code:
Dawn
There does not seem to be a permissions problem with the photos folder because you can see the pics with a direct link.
Here is how the photos folder works:
photos
2000
Christmas Elf.jpg
Mommy and Me.jpg
2001
etc...
2002
2003
Here is my ASP code:
Code:
private void Page_Load(object sender, System.EventArgs e){
string[] files = Directory.GetDirectories(MapPath("./photos"));
if(files.Length <= 0)
{
drpdwnPhotos.Items.Add("No Albums Available");
hasFiles = false;
return;
}
hasFiles = true;
int names = 1 + files[0].LastIndexOf(@"\");
foreach (string file in files)
{
ListItem item = new ListItem();
item.Value = file;
item.Text = file.Substring(names);
drpdwnPhotos.Items.Add(item);
}
hasAlbum = (Request.Cookies["albumName"] != null);
if(hasAlbum)
albumNamestr = Request.Cookies["albumName"].Value;
else
albumNamestr = files[0];
photoFiles = Directory.GetFiles(albumNamestr);
photoCount = photoFiles.Length;
if (photoCount <= 0) return;
int nameIndex = 1 + albumNamestr.LastIndexOf(@"\");
string albumStr = "<b>Album Year:</b> " + albumNamestr.Substring(nameIndex);
lblAlbumName.Text = albumStr;
dataAlbum.DataSource = photoFiles;
dataAlbum.DataBind();
HttpCookie MyCookie = new HttpCookie("albumName");
MyCookie.Value = albumNamestr;
MyCookie.Expires = DateTime.Now.AddDays(1);
Response.Cookies.Add(MyCookie);
}
protected void ShowFullImageHandler(object sender, System.Web.UI.WebControls.CommandEventArgs e)
{
string photoPath = ((ImageButton)sender).CommandName;
Session["photoPath"] = photoPath;
Session["photoFiles"] = photoFiles;
Session["photoIndex"] = photoIndex(photoPath);
Session["albumName"] = albumNamestr;
Server.Transfer("imageView.aspx");
}
public int photoIndex(string photoPath)
{
return Array.IndexOf(photoFiles, photoPath);
}
Dawn