tags:

views:

87

answers:

4

I have a wpf application (C#) that needs to copy a file to a server that is not part of a domain. FTP cannot be used. I looked into using LogonUser() within advapi32.dll but could impersonate the local user to the machine successfully. Are there any other options?

A: 

One is to open the security on the machine you are copying to, such that none authenticated users are aloowed to write to disk.

Another is to create a local user on the machine that you are writing to , that has the same name and password as the domain account making the call. This works in some situations.

Shiraz Bhaiji
The first is not an option, i have tried the second but the user fails to login, even though user and password are the same, shame!
Danny
A: 

Did you try WNetAddConnection(2|3)?

arbiter
+1  A: 

Hi...one option is there to upload file through WCF Service..in that case it is not required that it should be in same domain.

Here article's title is large file upload / download but it is meant only for small files upto [10 MB - 40 MB].

WCF File Upload Download

Second Option

Harryboy
This is much-much more complicated solution that simple file copy.
arbiter
Yes, I agree, why so difficut to sort out?
Danny
A: 

I was able to impersonate the local user by setting logonProvider to 0 and logonType to 9 using advapi32.dll.

Danny