There are a few approaches... unfortunately using Windows APIs.
1) Have the user create a mapped network drive to the files you need using the correct credentials. This will be outside of the control of your program though.
2) Change the security context of your application to run under the user that has access to the file with the LogonUser API. This requires that your computer is a member of the external domain though. I vaguely remember this being encapsulated in the .net framework somewhere so you might not need to use the Windows API.
3) The approach I ended up using which is the WNetAddConnection API. It is the equivalent of the Net Use command on the command prompt. It provides you with the equivalent functionality of opening a network address like \\computername\sharename and providing a username and password that can include the domain name if necessary just like you would be prompted for by Windows. It does not require making a mapped network drive.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.