VirtualPath to existing folder?

Vote:
 

How do i create a virtualpath to an existing folder (containing files)?

I have created a "upload"-folder by adding the following line to web.config, and this works just fine.

<add showInFileManager="true" virtualName="Upload" virtualPath="~/Upload/"
          bypassAccessCheck="false" physicalPath="D:\some\path\Upload"
          name="SiteUpload" type="EPiServer.Web.Hosting.VirtualPathVersioningProvider,EPiServer" />

 I was sure it would be just as easy to point to an exisitng folder (containing files) and just use VirtualPathNativeProvider. It shows up in filemanager, but i get error 404 when trying to browse the files... what did i miss?

#32622
Sep 09, 2009 16:28
Vote:
 

You need to add the path in the web.config like this

<location path="Upload">
    <staticFile expirationTime="-1.0:0:0" />
    <system.webServer>
      <handlers>
        <add name="webresources" path="WebResource.axd" verb="GET" type="System.Web.Handlers.AssemblyResourceLoader" />
        <add name="wildcard" path="*" verb="*" type="EPiServer.Web.StaticFileHandler, EPiServer" />
      </handlers>
    </system.webServer>
  </location>

#32628
Sep 09, 2009 21:52
Vote:
 
If you are using IIS 5/6 it could also be a problem with access rights in the local filesystem. For some reason that manifests itself as 404 and not some kind of access denied error.
#32629
Sep 10, 2009 7:57
Vote:
 

Hi

Tested with the config in you first post, but changed it to use VirtualPathVersioningProvider instead of versioning. I assume you did the same since you mentioned the native provider in your post. Anyway, worked like a charm for me.

Give the suggestions from Anders and Magnus a try and see if they solve the problem. Because what you are trying to do should work.

Regards

Per Gunsarfs
EPiServer CMS development team

#32635
Sep 10, 2009 12:46
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.