troubleshooting Question

How do I programmatically authenticate a user into a domain?

Avatar of saitcho
saitcho asked on
Windows NetworkingOS SecurityNetwork Security
4 Comments1 Solution670 ViewsLast Modified:
We have a .NET windows application that allows users to upload files to a shared folder on our network and also to view those files. The files are uploaded with FileInfo.CopyTo() and the files are viewed with Process.Start(fileName). This has been working well because all of the users of the application have been logged into the domain where the share is.

The app has recently been made available to users outside of our office. They will be coming in through a VPN (SonicWall) so we have created users for them in our domain, but after connecting through the VPN, they are not actually authenticated in the domain. If they try to access the files through the application at this point, there will be an exception because the share is not yet visible to them.

I have successfully used Uwe Keim's Impersonator class (http://www.codeproject.com/KB/cs/zetaimpersonator.aspx) to view the files. This class calls LogonUser() so that my call to Process.Start(fileName) is executed as a user that has permission to access the share. I can't use this technique for uploading the files, though, because the copy operation will need access to both the client's machine and the share.

If I have the users first browse to the share, they will be prompted by windows to supply their credentails and all is well with accessing the files through the app. Is there a way in code to mimic what happens when the user browses to the share and supplies credentials?
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros