views:

353

answers:

1

Hi,

I have windows server 2003 machine as a part of our network. I have created an administrator user on it.

Now this server system has a shared folder.

I am writing a C# application which will copy some files a local system to that shared folder in the windows server 2003 machine.

I have coded the file transfer code, it works fine if I authenticate the client machines using windows explorer to copy file into the shared folder on the server.

However If I don't authenticate using windows explorer my code gives Access Denied Error.

I want C# cope piece which can authenticate my file transfer application without entering the creds on windows explorer each time. The windows server has normal windows authentication.

Please help!!

Edit-

The server does not have an AD, please note that Iam authenticating against an AD, I just want to create an Authenticated windows session to the machine.

+1  A: 

You need to use impersonation.

The following KB article has some good information on using impersonation from .NET: http://support.microsoft.com/default.aspx?scid=kb;en-us;Q306158

A quick Google search turns up the following example (based on the same idea): http://www.codeproject.com/KB/cs/cpimpersonation1.aspx

Brannon
Hi Brannon, Its a VPN and impersonation does not work.
Sumit Ghosh