Do you have a corresponding <location> tag for your Global-folder in web.config? Should look something like this:
<location path="Global">
<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>
<staticFile expirationTime="-1.0:0:0" />
</location>
/Martin
Ah, yes I have... But it has the following Authorization settings as well:
<location path="Global">
<system.web>
<authorization>
<allow roles="WebEditors, WebAdmins, Administrators" />
<deny users="*" />
</authorization>
</system.web>
<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>
<staticFile expirationTime="-1.0:0:0" />
</location>
I tried to remove the system.web section above but it doesn't help anyway, the image link is still broken.
Could there be any kind of issue with the fact that the files I have are saved in the folder programatically? (However, I do have a similar solution using the PageFiles provider/folder and that works).
Hi!
You wrote "In the physicalPath folder directory I can also see that the file exists there.". Does that mean that you have a file in that folder named the same as the file you are requesting? If so that could be the problem, since the VirtualPathVersioningProvider uses another way of storing it's data on disk.
If you want to upload files programatically to a folder supported by a VirtualPathVersioningProvider, you need to use our unified file/directory api:s to do so. If you want to have a folder you can access both through the EPiServer file management as well as a windows file explorer, you should use a VirtualPathNativeProvider instead of the versioning one.
Regards
Per Gunsarfs
EPiServer Development Team
Can you open Global files in file manager? Try to upload image, open in file manager in Edit mode and check the file URL when it is opened in file manager.
Per:
No no, this was obviusly a bit unclear. I know about the file structure for versioned path providers. I have just used the "Date modifed" column in windows file explorer to identify my file(s). And I have used the Unified file/directory api for saving files.
Dmytro:
When I try to upload a file in the Episerver filemanager I actually get an error (see below). However, after reloading the file manager I can see the file in the structure but when I try to access it (double click, opens in new window) I get the 404.
Server Error in '/' Application.
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
EPiServer.UI.Hosting.UploadFile.UploadButton_Click(Object sender, EventArgs e) +1129
EPiServer.UI.WebControls.ToolButton.OnClick(EventArgs e) +102
EPiServer.UI.WebControls.ToolButton.RaisePostBackEvent(String eventArgument) +178
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +28
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2980
Version Information: Microsoft .NET Framework Version:2.0.50727.5456; ASP.NET Version:2.0.50727.5456
Hi!
I have a VirtualPathProvider configured in episerver.config as follows:
<add showInFileManager="true"
virtualName="Global Files"
virtualPath="~/Global/"
bypassAccessCheck="false"
name="SiteGlobalFiles"
type="EPiServer.Web.Hosting.VirtualPathVersioningProvider,EPiServer"
indexingServiceCatalog="Web"
physicalPath="C:\inetpub\CustomerName\vpp\Global" />
And I have a page with a XHTML property that contains the following image tag:
<img src="/Global/MyFolder/MyImage.jpg" alt="My image text" />
However, this image is displayed as a broken image link... Both in the editor and when viewing the page.
I can see that the file exists in the file manager. When I try to access the file directly by pasting MyDomain/Global/MyFolder/MyImage.jpg in the address field I get a 404 error.
In the physicalPath folder directory I can also see that the file exists there.
It seems to me that there is something wrong with the route-mapping from the virtualPath="~/Global/" to the physicalPath="C:\inetpub\CustomerName\vpp\Global".
I have the exact same corresponding setup for SitePageFiles:
<add showInFileManager="true"
virtualName="Page Files"
virtualPath="~/PageFiles/"
bypassAccessCheck="false"
name="SitePageFiles"
type="EPiServer.Web.Hosting.VirtualPathVersioningProvider,EPiServer"
indexingServiceCatalog="Web"
physicalPath="C:\inetpub\CustomerName\vpp\PageFiles" />
and this is working without problem. In the siteSettings config element the name "SitePageFiles" is set as value for the pageFolderVirtualPathProvider attribute. But I can not find that a corresponding setting for the global files exists.
Any input on this is most welcome. Thank you.
/Dan