Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Looking for best practice for doing a "Net Use" in C#

Tags:

c#

.net-1.1

I'd rather not have to resort to calling the command line.
I'm looking for code that can map/disconnect a drive, while also having exception handling.

Any ideas?

like image 346
steve_mtl Avatar asked Aug 12 '08 14:08

steve_mtl


1 Answers

Use P/Invoke and WNetAddConnection2
There should also be some wrappers out there to do some of the grunt work for you.
Google is your friend, as always.

like image 147
Lars Mæhlum Avatar answered Nov 04 '22 09:11

Lars Mæhlum