November Happy Hour will be moved to Thursday December 5th.

VirtualPathNativeProvider as other user?

Vote:
 

Hello!

I want to set up a Virtual Path Provider pointing to a a folder on another machine so i put this in my Web.Config:

<add showInFileManager="false"
  virtualName="Z"
  virtualPath="~/Z/"
  bypassAccessCheck="true"
  physicalPath="\\257.1.2.3\MyShare"
  name="Zcolon"
  type="EPiServer.Web.Hosting.VirtualPathNativeProvider,EPiServer" />

This works fine when I run the site locally or on my development server and the VPP is set up pointing to some test share. However, in the live environment the VPP is pointing to a share that requires authentication, something like <domain on remote machine>\username + password.

When remote-desktopping to the live environment I can connect to the remote machine by just running \\257.1.2.3\MyShare and manually type in the authentication credentials as I am prompted so I am sure that the connection between the web server and the customers file server is up and running.

My question is of course, how would I go about this programmatically? I have done some shallow research into coding something like VirtualPathNativeImpersonatedProvier : VirtualPathNativeProvier and implementing impersonation like this but I haven't gotten around to testing it much yet since it completely kills the site when it's not working:

<add showInFileManager="false"
  virtualName="Z"
  virtualPath="~/Z/"
  bypassAccessCheck="true"
  physicalPath="\\257.1.2.3\MyShare"
  name="Zcolon"
  domain="RemoteMachineDomain"
  username="RemoteUser"
  password="zeEagleHasLanded"
  type="MyNamespace.VirtualPathNativeImpersonatedProvider,MyAssembly" />

Even if I got it working, would I just set up auth. credentials and then start impersonating in the VPP constructor?

 

Is there some "more cleverer" way of doing this?

#46698
Dec 28, 2010 9:39
Vote:
 

Hi,

 

Couldn't you change the application identify to a user that is authenticated on the share? IE user exists both on the file share machine and web server.

#46702
Dec 28, 2010 11:33
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.