2
Vote

Bug on Gallery Class if website have an application path

description

If we use your project on a sub web site :
Root site : http://sss.com/
SubWebSIte : http://sss.com/myGallery
 
The gallery class throw an exception on the Get Files property.
 
Source of the problem :
Class Gallery - function AddFileRecursively
 
you are using these lines :
int index = directory.FullName.Replace("\", "/").IndexOf(this.FolderUrl);
fileNames.Add((directory.FullName.Replace("\", "/").Substring(index) + "/" + fi.Name).Replace("//", "/"));
 
instead of that, use this :
declare these private members : String appPhysicalPath, appUrlPath
Initialize them in the gallery constructor
then,
replace fileNames.Add( ... ) with
fileNames.Add(fi.FullName.Replace(appPhysicalPath,appUrlPath).Replace("\", "/"));
 
See attach file for correcting bug.

file attachments

comments