Error in workroom filemanager

Member since: 2008
 
I am using the file manager from the CMS 5 R2 SP1 demo templates in a page type. It works as expected, except to look at file versions. If I try to bring up a file version (links point to /path/to/file.extension/GUID) I get an access denied exception for aspnet ("ASP.NET is not authorized to access the requested resource") in EPiServer.Web.Hosting.VersioningFile.GetVersions(). I checked the permissions for the ASP.NET account and they seem OK to me (read, write, execute). Is something else limiting the access to file verisons?
#30101 Jun 02, 2009 9:57
  • Member since: 2010
     
    Sounds like you are using WindowsMembership Provider and perhaps you should try setting it up in ASPNET_REGUSR to use a database?
    #30105 Jun 02, 2009 12:47
  • Member since: 2008
     

    No I use the multiplexing providers with starsuite and sql providers. Could you please explain the aspnet_regusr scenario a bit more, I am not familiar with it?

    Edit: It seems to be a server configuration issue, I get the same error message if I try to open a file version from the admin mode file manager. On a different system I don't get these errors, but I can not download file versions (the web browser says that the file does not exist).

    #30108 Edited, Jun 02, 2009 14:11
  • Member since: 2010
     

    Well you see the ASP.Net client is a Windows user - complete with their own account.  I would first try checking the folder security and make sure that the account for ASP.Net can access the folder.  

     Check the link http://www.mvps.org/marksxp/WindowsXP/aspdot.php for more information about that.

     

    I assume you have never had access to these files ever so this is probably the answer. The process REGUSR is similar to in Visual Studio, going to "Project" tab and selecting "ASP.Net Configuration" this is where you can configure your solutions user and role management.  You should be familiar with this part of ASP.Net?

     

    Good luck!

     

    #30176 Jun 04, 2009 11:58
  • Member since: 2008
     

    Thank you for yor reply. 

    Yes, I have checked the ASP.NET user's file permissions. They seem fine (the same as for any other files in the VPP, which I can access, though these files don't come in multiple versions).

    It is also possible to get all files without problem, but only the current version of the file. My problem only occurs when I bring up the version list and try to view a specific version. I can roll back to any version (which actually creates a new current version) and open it as the current version, but I can not read any of the previous versions.

    I have never heard of aspnet_regusr, I suppose you don't mean aspnet_regiis since you compare it to the ASP.Net configuration. The users/roles there however are the same as can be administered from EPiServer, right?

    They have the correct permissions in file management, if they don't they won't see the files or delete/check out etc will be disabled according to permissions. The users have full access and can create new versions, remove files etc. But not view previous versions of the files, which generates the error (404 or autorization, seems to depend on if I have friendly errors or not). The URL the browser tries to get when getting a version is the same as for the current version, but with a slash and a GUID appended. I suppose the VPP interprets this wrong in some way and actually looks for a file named as the GUID?

    #30192 Jun 05, 2009 12:47
  • Member since: 2010
     

    No problems - glad to help! Yes I did mean REGIIS - but the main thing I would like to know is, have you tried backing up the files and doing a fresh install to see if it's just a configuration bug - something that got changed like a property or something?

    #30194 Jun 05, 2009 13:01
  • Member since: 2008
     

    No I haven't, I will if I can find the time. But I discovered something else strange. When I logged in as the user who created the file versions I can download them. Even though the file permissions of that user are equal to those of the admin user. So only the creator can download previous file versions?

    A complication issue is perhaps that there are two user databases in multiplexing (sql and starsuite providers). But even if I log in as a user from the same database as the user who can download the file, I get the same error as with a user from the other database. So that still points to the creator.

    An other complication is that this is a migrated site and the file versions I'm trying to access were created before the migration.

    #30195 Jun 05, 2009 13:08
  • Member since: 2003
     
    We're experiencing the same issue with the workroom as well as files uploaded directly into the File Manager.
    We've given the Network Service account permission to the folders but are still getting the access denied error.
    #31237 Jul 13, 2009 7:05
  •  

    I've been having a similar issue trying to access previous file versions.

    I've lodged a number of support calls and even the code i'm given back by EPiServer does not seem to work correctly.

     <%

    foreach (EPiServer.Web.Hosting.UnifiedVersion file in ((EPiServer.Web.Hosting.VersioningFile)System.Web.Hosting.HostingEnvironment.VirtualPathProvider.GetFile("/Global/myfile.gif")).GetVersions())
    {

    %>  

    <a href="<%=file.VirtualPath + "/download" + file.Extension %>">
         <%=file.Name%>
    </a>

    <%

    } %>

     

    This still ends up saying the file does not exist.  I can't find any implementations are code examples of this working and my client is currently giving me a lot of hassle for something that they see as basic functionality of the platform.

    Has anyone got any sample code of this working?

    Thanks,

    Simon

    #31466 Jul 31, 2009 15:16
  •  

    I have coded the following solution which should assist.  The code takes the versions which exist for a file in the Documents folder and displays them simply on a web page, as links which can be opened (inserted into a DIV element ID=generatedVersionsBox) - all of which can also be used with "Save Target As" function.

    Hope this helps - EPiServer Support Team...

    using EPiServer.Web.Hosting;

    using System.Collections.Generic;

    protected void PathTest_Click(object sender, EventArgs e)

    {

    generatedVersionsBox.InnerHtml = "";

    string documentPath = "~/Documents/";

    bool documentDirExists = System.Web.Hosting.HostingEnvironment.VirtualPathProvider.DirectoryExists(documentPath);

    if (documentDirExists)

    {

    foreach (VersioningFile file in System.Web.Hosting.HostingEnvironment.VirtualPathProvider.GetDirectory(documentPath).Files)

    {

    IList<UnifiedVersion> versions = file.GetVersions();

    foreach (UnifiedVersion version in versions)

    {

    string filePath = version.VirtualPath;

    if (filePath.EndsWith("/") == false)

    {

    filePath = filePath + "/";

    }

    string versionNumber = version.Name;

    string virtualPathWithoutGuid = version.VirtualPath.Substring(0, filePath.Substring(0, filePath.Length - 1).LastIndexOf('/'));

    string nameOfVersionedFileFromVirtualPath = virtualPathWithoutGuid.Substring(virtualPathWithoutGuid.LastIndexOf('/') + 1);

    string nameToSave = nameOfVersionedFileFromVirtualPath.Substring(0, nameOfVersionedFileFromVirtualPath.IndexOf('.')) + "_V" + versionNumber;

    generatedVersionsBox.InnerHtml = generatedVersionsBox.InnerHtml + "<a href='" + filePath + nameToSave + "'>" + nameToSave + "</a><br />";

     

    }

    }

    }

    }

    #31659 Aug 05, 2009 17:00
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.
Please login to post a reply