These forums are read-only and considered to be an archive. Please use the new Community for future interaction and posts.

Impersonation and network shares

I'm using FileUltimate in a asp.net C# application.

I'm doing this:

<GleamTech:FileManager ID="VistaFileManager" runat="server" FullViewport="false" Width="100%" />

FileManagerRootFolder rootFolder = new FileManagerRootFolder(name, path);
rootFolder.Permissions = FileManagerPermissions.Full;
this.VistaFileManager.RootFolders.Add(rootFolder);

I get the error:  "Attempted to access a path that is not on the disk" The status code is 500 Internal Server Error.
If I test the same path I'm using in code in windows explorer or a web browser it works fine!
Any ideas?
We have an old installation of FileVista that uses the same code and path as above and it works fine. The difference is that in the old FileVista the web control is in a separate virtual folder in IIS. Impersonate = true on that folder did the trick there. 
How can I do the same setting with FileUltimate? The FileUltimate control is not in a separate folder, it's just a dll.
Marty 12/5/2012 4:08 AM
Hi Marty,
It's a permission issue.
You need to find out under which user context, your application is running:

Reponse.Write(System.Security.Principal.WindowsIdentity.GetCurrent().Name);

Then give Modify permission to that user on the target folder.
Cem Alacayir 12/5/2012 4:25 AM
Thank you for the quick reply. 

The network share I'm trying to connect to is a Distributed File System with multiple and different sources. I have suggested this solution to the customer already and it's not possible to set permission this way. It's too many sources to handle the permissions on..

Any other way to solve this with some kind of impersonation?
Marty 12/5/2012 4:51 AM
Then you should turn on impersonation in your application's web.config:

 <system.web>
    <identity impersonate="true" />
 </system.web>
Cem Alacayir 12/5/2012 5:03 AM
Turn on impersonation for the whole web application? 

There is also a web.config in the folder /FileUltimate/Web.config 
Is it not possible do set this setting here instead?
Marty 12/5/2012 5:08 AM
Yes, /FileUltimate/Web.config will be active for all FileUltimate related requests so impersonation setting should work there. You can add it after <system.web> on line 56.
Cem Alacayir 12/5/2012 5:27 AM
Thank you very much, works perfect now!
Marty 12/5/2012 5:43 AM
Hi!

Is the solution above, where you could turn on impersonation for FileUltimate related requests in /FileUltimate/Web.config, supposed to work also in version 3.6.1 of FileUtlimate?

I'm getting an "access denied" error for the moment, but if I instead turn on impersonation in the application's Web.config, I can access the folder.

Any ideas?
Mike 5/23/2013 4:43 AM
We removed FileUltimate\Web.config after version 3.6 as it caused confusion and problems on some project folder structures. FileUltimate is now config-free, you only need to deploy the DLL. Except, you may need to add some settings to your application's Web.config for increasing request limits if you want to support lowest level upload method Html4 upto 2GB of files (more info in readme.txt).

Regarding your question, you should still be able to restrict settings to FileUltimate related requests by using 2 location tags in your application's Web.config :

  <location path="fileuploader.ashx">
     <system.web>
        <identity impersonate="true" />
     </system.web>
  </location>
  <location path="filemanager.ashx">
     <system.web>
        <identity impersonate="true" />
     </system.web>
  </location>

Let me know if this doesn't work.
Cem Alacayir 5/23/2013 5:41 AM
It works like a charm, many many thanks!
Mike 5/23/2013 6:21 AM