Exemple #1
0
        public bool VirtualFileExists(string virtualPath)
        {
            VirtualPathProvider vpp = HostingEnvironment.VirtualPathProvider;

            // TODO: Remove the second condition of the "if" statement (it is only a workaround) involving DefaultVirtualPathProvider as soon as Mono's DefaultVirtualPathProvider.FileExists method works properly (i.e., the indirectly-called HostingEnvironment.MapPath method should not require an HttpContext.Current.Request object to do its work; also see the comment in the ApplicationHost.MapPath method above)
            if (vpp != null && !vpp.GetType().FullName.Equals("System.Web.Hosting.DefaultVirtualPathProvider", StringComparison.Ordinal))
            {
                return(vpp.FileExists(virtualPath));
            }

            return(File.Exists(MapPath(virtualPath)));
        }