I want to open a mapped network drive from C# code, but it is password protected, so when I try to open it directly an exception is thrown. Can someone shed light on providing a username and password while opening the this drive? Exception details:
at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start(String fileName)
I am just calling System.Diagnostics.Process.Start("Z:")
Z: is not a file name. [edit: it’s ok if it’s not password protected, tried executing your code and it worked]
Try using a ProcessStartInfo object as a parameter, as it allows setting a username and password.
And about the FileName parameter from here: