|
-
Sep 21st, 2008, 03:37 AM
#1
Thread Starter
Member
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...
-
Sep 21st, 2008, 06:06 AM
#2
New Member
-
Sep 22nd, 2008, 08:41 AM
#3
Thread Starter
Member
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.
-
Sep 22nd, 2008, 10:41 AM
#4
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
-
Sep 24th, 2008, 03:00 PM
#5
New Member
Re: Network Authentication in VB 2005
 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.
-
Sep 24th, 2008, 04:05 PM
#6
Re: Network Authentication in VB 2005
glad I could help
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|