Try our conversational search powered by Generative AI!

Setting showInFileManager="false" for virtual name "Page Files" throws an exception

Vote:
 

Hi,
I want to hide "Page Files" in FileManagerBrowser dialog, but when I set showInFileManager="false" in episerver.config FileManagerBrowser dialog throws and exception:

Exception Details: System.InvalidCastException: Unable to cast object of type 'EPiServer.Web.Hosting.VirtualPathNonUnifiedProvider' to type 'EPiServer.Web.Hosting.VirtualPathUnifiedProvider'.

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:

[InvalidCastException: Unable to cast object of type 'EPiServer.Web.Hosting.VirtualPathNonUnifiedProvider' to type 'EPiServer.Web.Hosting.VirtualPathUnifiedProvider'.]
   EPiServer.UI.Hosting.<>c__DisplayClass3.<ResolveCurrentDirectory>b__0(VirtualPathProvider vpp) +34
   System.Linq.<>c__DisplayClassf`1.<CombinePredicates>b__e(TSource x) +21
   System.Linq.WhereEnumerableIterator`1.MoveNext() +141
   EPiServer.UI.Hosting.VirtualPathFileManager.ResolveCurrentDirectory(UnifiedDirectory& directory) +624
   EPiServer.UI.Hosting.VirtualPathFileManager.CreateChildControls() +284
   EPiServer.UI.Hosting.VirtualPathFileManager.DataBind() +67
   EPiServer.UI.Hosting.VirtualPathFileManager.OnInit(EventArgs e) +30
   System.Web.UI.Control.InitRecursive(Control namingContainer) +140
   System.Web.UI.Control.InitRecursive(Control namingContainer) +311
   System.Web.UI.Control.InitRecursive(Control namingContainer) +311
   System.Web.UI.Control.InitRecursive(Control namingContainer) +311
   System.Web.UI.Control.InitRecursive(Control namingContainer) +311
   System.Web.UI.Control.InitRecursive(Control namingContainer) +311
   System.Web.UI.Control.InitRecursive(Control namingContainer) +311
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +480
  
How to reproduce:
1. Creata a site with EPiServer CMS 6 R2
2. Open episerver.config
3. Change showInFileManager="true" to showInFileManager="false" in
 <virtualPath customFileSummary="~/FileSummary.config">
    <providers>
      <clear />
      <add showInFileManager="false" virtualName="Page Files" virtualPath="~/PageFiles/" bypassAccessCheck="false" name="SitePageFiles" type="EPiServer.Web.Hosting.VirtualPathVersioningProvider,EPiServer" indexingServiceCatalog="Web" ...

#51424
Jun 08, 2011 10:48
Vote:
 

Setting showInFileManager to false works fine in my EPiServer CMS 6 R2 demosite. Could it be a problem with any of the other VPP's registered?

#51432
Jun 08, 2011 12:50
Vote:
 

Hi Mari,
your post gave me a hint and after 10 min of testing I found where is the problem and a solution for it.
Yes we are using a custom VPP. Here is the original virtualPath section in episerver.config before I found the problem

<virtualPath customFileSummary="~/FileSummary.config">
    <providers>
      <clear />
      <add showInFileManager="true" virtualName="Page Files" virtualPath="~/PageFiles/" bypassAccessCheck="false" name="SitePageFiles" type="EPiServer.Web.Hosting.VirtualPathVersioningProvider,EPiServer" indexingServiceCatalog="Web" physicalPath="SomePath\PageFiles" />
      <add showInFileManager="false" virtualName="Global Files" virtualPath="~/Global/" bypassAccessCheck="false" name="SiteGlobalFiles" type="EPiServer.Web.Hosting.VirtualPathVersioningProvider,EPiServer" indexingServiceCatalog="Web" physicalPath="SomePath\Global" />
      <add showInFileManager="false" virtualName="Documents" virtualPath="~/Documents/" bypassAccessCheck="false" maxVersions="5" name="SiteDocuments" type="EPiServer.Web.Hosting.VirtualPathVersioningProvider,EPiServer" physicalPath="SomePath\Documents" />
      <add name="App_Themes_Default" virtualPath="~/App_Themes/Default/" physicalPath="SomePath\CMS\6.1.379.0\application\App_Themes\Default" type="EPiServer.Web.Hosting.VirtualPathNonUnifiedProvider,EPiServer" />
      <add name="UI" virtualPath="~/secure/CMS/" physicalPath="SomePath\CMS\6.1.379.0\application\UI\CMS" type="EPiServer.Web.Hosting.VirtualPathNonUnifiedProvider,EPiServer" />
      <add name="UtilFiles" virtualPath="~/Util/" physicalPath="SomePath\CMS\6.1.379.0\application\util" type="EPiServer.Web.Hosting.VirtualPathNonUnifiedProvider,EPiServer" />
      <add name="WebServiceFiles" virtualPath="~/WebServices/" physicalPath="SomePath\CMS\6.1.379.0\application\webservices" type="EPiServer.Web.Hosting.VirtualPathNonUnifiedProvider,EPiServer" />
      <add name="EPiServerCMS" virtualPath="~/secure/CMS" physicalPath="SomePath\CMS\6.1.379.0\application\UI\EPiServer\CMS" type="EPiServer.Web.Hosting.VirtualPathNonUnifiedProvider,EPiServer" />
      <add name="EPiServerShell" virtualPath="~/secure/Shell" physicalPath="SomePath\Framework\6.2.267.1\Application\UI" type="EPiServer.Web.Hosting.VirtualPathNonUnifiedProvider,EPiServer" />
      <add name="Upload" virtualPath="~/Upload/" virtualName="Upload" showInFileManager="true" bypassAccessCheck="false" type="CustomVirtualPathProvider" connectionStringName="CustomVirtualPathProviderConnectionString" />
    </providers>
    <filters />
  </virtualPath>

As you can see there is one custom VPP with name Upload at the bottem of the list which inherits VirtualPathUnifiedProvider. The site was working fine, but when I changed SitePageFiles attribute from showInFileManager="true" to showInFileManager="false" the FileManagerBrowser dialog start throwing an exception.
After your post I played a bit with virtualPath section and I noticed that leaving one of the first three providers (SitePageFiles, SiteGlobalFiles and SiteDocuments) with showInFileManager="true" is enough for the dialog to work without errors. At the end I found that if our custom VPP change places with App_Themes_Default, i.e. from the end of the list to before any VirtualPathNonUnifiedProvider declaration - the dialog is working. Any declaration of others default EPiServer providers of type VirtualPathNonUnifiedProvider before our custom provider will cause an exception. So the problem should be changed to:
Declaration of a custom virtual path provider based on VirtualPathUnifiedProvider after a provider of type VirtualPathNonUnifiedProvider when SitePageFiles, SiteGlobalFiles and SiteDocuments providers are set with showInFileManager="false" will cause FileManagerBrowser dialog to throw an exception.
The solution is obvious - leave all VirtualPathNonUnifiedProvider providers declaretions after your custom VPP like this:

<virtualPath customFileSummary="~/FileSummary.config">
    <providers>
      <clear />
      <add showInFileManager="false" virtualName="Page Files" virtualPath="~/PageFiles/" bypassAccessCheck="false" name="SitePageFiles" type="EPiServer.Web.Hosting.VirtualPathVersioningProvider,EPiServer" indexingServiceCatalog="Web" physicalPath="SomePath\PageFiles" />
      <add showInFileManager="false" virtualName="Global Files" virtualPath="~/Global/" bypassAccessCheck="false" name="SiteGlobalFiles" type="EPiServer.Web.Hosting.VirtualPathVersioningProvider,EPiServer" indexingServiceCatalog="Web" physicalPath="SomePath\Global" />
      <add showInFileManager="false" virtualName="Documents" virtualPath="~/Documents/" bypassAccessCheck="false" maxVersions="5" name="SiteDocuments" type="EPiServer.Web.Hosting.VirtualPathVersioningProvider,EPiServer" physicalPath="SomePath\Documents" />
      <add name="Upload" virtualPath="~/Upload/" virtualName="Upload" showInFileManager="true" bypassAccessCheck="false" type="CustomVirtualPathProvider" connectionStringName="CustomVirtualPathProviderConnectionString" />
      <add name="App_Themes_Default" virtualPath="~/App_Themes/Default/" physicalPath="SomePath\CMS\6.1.379.0\application\App_Themes\Default" type="EPiServer.Web.Hosting.VirtualPathNonUnifiedProvider,EPiServer" />
      ...
    </providers>
    <filters />
  </virtualPath>

#51438
Edited, Jun 08, 2011 14:45
Vote:
 

Hi

Nice catch. There seems to be a problem when the first non hidden vpp is not a unified vpp. I've registered it as a bug in our bug tracking system:

"Bug #69410: The first vpp with showInFileManager set to true has to be a VirtualPathUnifiedProvider"
 
And as you figured out, as long as you keep all VirtualPathNonUnifiedProviders at the end of the configuration, you shouldn't see this problem.
 
Regards
 
Per Gunsarfs
EPiServer Development Team
#51445
Jun 08, 2011 15:58
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* 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.