asp.netiis-7.5virtualpathprovider

HostingEnvironment.VirtualPathProvider.FileExists returns false on existing file


I'm trying to read a file in a virtual path, using the following code

HostingEnvironment.VirtualPathProvider.FileExists(_SiteMapFileName)

_SiteMapFileName has something like "~/Content/en-US/MainMenu.sitemap" and it is always returning false.

But if I access the URL of that virtual path (http://www.local.mysite.com/Content/en-US/MainMenu.sitemap), the file displays correctly in the browser

Content is a virtual directory under my website, pointing to a shared folder on a different location. If I access that location on Windows Explorer I can see the files correctly

I've set the site and the virtual directory to connect as my network account.

I used the process monitor tool to see if there's any problem and it says that w3wp.exe is trying to create the file \path\to\shared\location\Content\en-US\MainMenu.sitemap but it is getting ACCESS DENIED which is fine since it is a read-only location

Does anybody now how to solve this issue?


Solution

  • I found out the reason. The user set to run the app pool tied to the application needs to have permissions on the file is trying to read, not only the website and the virtual directory. :/