Network Authentication in VB 2005
Hi, I tried to connect to a network shared folder (actually i share my access db in the network) but i couldn't make it connected unless i map it in every pc that will use my prog. i am trying not to map it for some other reasons. What I'm trying to say is upon loading my startup form or my application, the network authentication window should appear first just like when you do "RUN", "\\IPAddress\SharedFolderName$\dbname.mdb".
Rgds...
Re: Network Authentication in VB 2005
I have excacly the same problem
Hi to all
Please forgive me but i am a noob to the exciting word of programming :)
I try to make a VB2008 with framework 2.0 and 3.5 project that will connect to my other local computer and download a file
when i press start from windows -> run -> \\mypc2\c$ it prompts me about my username and password , i enter them and i can see all the c: drive of my remote computer and download the data, even when i use the code emmidietly:
my.computer.network.downloadfile("\\mypc2\c$\text.txt", "c:\test.txt", username,password) it works fine , but if i reboot my computrer and run my project i get the responce "wrong username or bad password" again and again :(
I need some cind of network credentials or something else?
please advice us the noobs :)
Re: Network Authentication in VB 2005
hi jimiol, tnx for sharing the same issue. btw, u can temporarily use the WNetAddConnection2 by mapping your target shared file.
In my case, as much as possible, I will not use the map option. I'm trying to use either WNetAddConnection3 orWNetConnectionDialog but until now I couldn't make a correct code, I was stucked by this PInvoke error.
Re: Network Authentication in VB 2005
Not the most elegant solution but I would just Shell the Net Use command to authenticate you before running the part of your program that needs to access that folder. So for example:
vb Code:
Shell("Net Use \\IPADDRESS\Share /user:UsernameHere PasswordHere", AppWinStyle.Hide, True, 10000)
This code will create a connection to the specified shared folder with the credentials you provide by using the Net.exe program that is included with Windows. The arguments after the net use command are just telling the program to not display the command prompt window that would normally appear when running Net.exe and it also tells the program to wait for the net.exe program to complete its operation (unless this exceeds 10000 miliseconds - 10 seconds)
Hope that helps
Re: Network Authentication in VB 2005
Quote:
Originally Posted by chris128
Not the most elegant solution but I would just Shell the Net Use command to authenticate you before running the part of your program that needs to access that folder. So for example:
vb Code:
Shell("Net Use \\IPADDRESS\Share /user:UsernameHere PasswordHere", AppWinStyle.Hide, True, 10000)
This code will create a connection to the specified shared folder with the credentials you provide by using the Net.exe program that is included with Windows. The arguments after the net use command are just telling the program to not display the command prompt window that would normally appear when running Net.exe and it also tells the program to wait for the net.exe program to complete its operation (unless this exceeds 10000 miliseconds - 10 seconds)
Hope that helps
Chris worked like a charm!
You are a lifesaver, you solved my problem and now my project works perfect every time. :D
Re: Network Authentication in VB 2005