Litte Programmer
Litte Programmer

Reputation: 1

Save credentials via WNetAddConection API

I'm creating a desktop app in C# using aejw API. Then i have to map a persistent network drive connection with stored authentication.

There is a sample code i using without effect. The code maps share succesfully, but dont store a password in Credential Manager. It is posssible to take the effect(store password) what i want using 'Runtime.InteropServices'

NetworkDrive nd = new NetworkDrive();
             nd.LocalDrive = "Y:";
             nd.Persistent = true;
             nd.SaveCredentials = true;
             nd.ShareName = @"\\server\share";
             nd.MapDrive(username, password);

Upvotes: 0

Views: 65

Answers (0)

Related Questions