troubleshooting Question

How do I programmatically authenticate a user into a domain?

Avatar of saitcho
saitcho asked on
OS SecurityNetwork SecurityWindows Networking
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?
ASKER CERTIFIED SOLUTION
Ron Malmstead
Sr. Developer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Log in to continue reading
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform for $9.99/mo
View membership options
Unlock 1 Answer and 4 Comments.
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
The Value of Experts Exchange in My Daily IT Life

Experts Exchange (EE) has become my company's go-to resource to get answers. I've used EE to make decisions, solve problems and even save customers. OutagesIO has been a challenging project and... Keep reading >>

Mike

Owner of Outages.IO
Phoenix, Arizona, United States
Member Since 2016
Join a full scale community that combines the best parts of other tools into one platform.
Unlock 1 Answer and 4 Comments.
View membership options
“All of life is about relationships, and EE has made a virtual community a real community. It lifts everyone's boat.”
William Peck

Member since 2004