Home All Groups Group Topic Archive Search About

Re: Accessing fileshare using system.IO

Author
25 Jul 2006 8:40 AM
Laura T
It is possible. You could also grant permissions for an user of your domain.
Otherwise you could do a WNetAddConnection2/3 to "logon" on the DMZ machine
(in effect you simulate a net use), copy the file and then delete the
connection.

WNetAddConnection3(Form1.Handle,MapDriveStruct,"copyuser","NLIIS405\copyuser",CONNECT_INTERACTIVE);
File.Copy(...)
WNetCancelConnection2(...)

Docs for WNetXXX APIs are here:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wnet/wnet/windows_networking_functions.asp



Show quote
"Michel Smit" <mpsmit@community.nospam> ha scritto nel messaggio
news:6231CF70-6114-4C1D-BE21-4A0421995DAD@microsoft.com...
>I have a machine in a domain 'HOME' and a machine in a DMZ which is not
>able
> to communicate with the 'HOME' domain, and thus has it's own local users
> and
> groups.
>
> I'm writing a .NET assembly which will copy files from the machine in the
> domain to the machine in the DMZ. When mapping a drive in Explorer I use
> the
> credentials of the DMZ machine: NLIIS405\copyuser, password: copyuser.
> This
> proves that the connection is available.
>
> The problem is the file.copy in the assembly. I always get an access
> denied
> because I should copy the file using the DMZ machine credentials.
>
> Is there a way to copy files from the domain machine to the DMZ machine
> using a DMZ machine login? I suspect it has to do with impersonation, but
> don't know if the above is possible.
>
> Does someone has experience with connecting to a network share from a
> server
> which is not connected to a domain?
> --
> Michel Smit
> Atos Origin Nederland BV

AddThis Social Bookmark Button