How do I access a file share programmatically
.net, c#, file-sharing, winforms
Solution
The accepted answer on this question here seems like it would be worth looking into; it suggests using the Win32 API function WNetUseConnection.
From MSDN:
The WNetUseConnection function makes a connection to a network resource. The function can redirect a local device to a network resource.
Which seems to accomplish what you're looking for, with no mention of `net.exe`. Does this help?
Problem
I have a windows forms app running on a machine that is not on a domain, that needs to be able to move a file from the local filesystem to a UNC path. I have a username and password for that path. I was wondering is there any way to do this directly with out execing the `net.exe` command? Ideally I wouldn't have to map a drive.