Support for UNC based virtual directories


My scenario is this:

My images reside on a network share (NAS device, actually). I have read only access to this share via a UNC path.

I have the network share setup as a virtual directory in IIS. PhotoHandler is also setup. The structure looks like this:

<root>\PhotoHandler {this is setup as a .NET 2.0 web app}
<root>\PhotoHandler\images (this is the virtual directory that connects to the network share)

Problem is that the handler doesn't see the images directory. If I create a physical folder there is works fine.
Closed Apr 3, 2008 at 12:34 AM by
The handler relies on the physical exploration of the folders from the place where the handler is. I have no plans to probe for virtual directories, which would be a lot more expensive (and would potentially require higher trust). You should be able to make that work by putting the handler in the virtual directory with the files, provided you give the user under which ASP.NET runs access rights.


gbordier wrote Dec 31, 2007 at 11:49 AM

Same scenario, but I placed the handler on the vdir mapped to the UNC share and got a security exception that may be related to MetaDataExtractor.dll rather than the handler itself ...

Line 1087: if (cached == null) {
Line 1088: Metadata data = new Metadata();
Line 1089: ExifReader exif = new ExifReader(pictureFileInfo);
Line 1090: exif.Extract(data);
Line 1091: IptcReader iptc = new IptcReader(pictureFileInfo);

Source File: \gbordiers05\photos\all\83-251207\album.ashx Line: 1089

Stack Trace:

[SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) +0
System.Security.CodeAccessPermission.Demand() +59
System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) +684
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) +114
System.IO.FileInfo.Open(FileMode mode, FileAccess access) +37
com.drew.imaging.jpg.JpegSegmentReader.GetJpegInputStream() +243
com.drew.imaging.jpg.JpegSegmentReader.ReadSegments() +147
com.drew.imaging.jpg.JpegSegmentReader..ctor(FileInfo aFile) +54
com.drew.metadata.exif.ExifReader..ctor(FileInfo file) +43
Bleroy.Photo.ImageInfo.GetImageData(FileInfo pictureFileInfo) in \gbordiers05\photos\all\83-251207\album.ashx:1089
Bleroy.Photo.ImageInfo.GetImageDate(FileInfo pictureFileInfo) in \gbordiers05\photos\all\83-251207\album.ashx:1114
Bleroy.Photo.Album.b__0(FileInfo x, FileInfo y) in \gbordiers05\photos\all\83-251207\album.ashx:2038
System.FunctorComparer1.Compare(T x, T y) +19
1.SwapIfGreaterWithItems(T[] keys, TValue[] values, IComparer`1 comparer, Int32 a, Int32 b) +125