Click here to Skip to main content
15,890,982 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I have a question.. :(
I have a maped network drive every time . when I want to log in to my maped network drive. it wants me to set username and password.
How can I set username and password for login to a network drive by code????
Posted
Comments
DaveAuld 5-Sep-10 6:50am    
When you create the Mapped Drive in MyComputer, there is a tick box for 'Reconnect at Logon', it shouldn't ask for the password again.
b.mahsa 5-Sep-10 14:00pm    
but when I restart my pc , every time I have to login at least on time to remember my user and pass.

1 solution

See this article here on CodeProject on how to Map Network Drives from code,
Map Network Drive (API)[^]

It is in C#, but you should be able to understand it and convert to VB.net quite easily.

In general though, to access network resources and read/write files direct from shares etc. You need to use the NetworkCredential class.
 
Share this answer
 
v2
Comments
b.mahsa 5-Sep-10 14:01pm    
thanks I saw that article its realy great . but that was usefull when I want to map a network drive not login to a network drive that almost maped.
DaveAuld 5-Sep-10 14:03pm    
I am sure you need to set NetworkCredential, then when you access the map it will authenticate using the NetworkCredential details.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900