Solved

Creating VPN Connection from VB with user credentials

Posted on 2006-06-13
5
848 Views
Last Modified: 2008-01-09
Hi.

I used the following example to create a VPN connection:

http://www.freevbcode.com/code/Dun_Module.zip

I would now like to create the VPN connection with the username, password and domain preset.

Heres what I have tried so far:

From the CreateNewEntry sub on the form:

------------------------------------------------------------------------------------

Dim typVBRasEntry As VBRasEntry
typVBRasEntry.DeviceName = "WAN MiniPort (PPTP)"
typVBRasEntry.DeviceType = "modem"
typVBRasEntry.fNetProtocols = RASNP_Ip
typVBRasEntry.FramingProtocol = RASFP_Ppp
typVBRasEntry.LocalPhoneNumber = "192.168.0.15"

Dim RASParams As VBRasDialParams
RASParams.UserName = "testusername"
RASParams.Password = "testpassword"
RASParams.Domain = "testdomain"
 
Dim rtn As Long
rtn = VBRasSetEntryProperties("DUN NAME", typVBRasEntry, RASParams)

added to VBRasSetEntryProperties on the Module ---->

CopyStringToByte b(1249), RASParams.UserName, lngStrLen

----------------------------------------------------------------------------------------------

Any help is much appreciated!

0
Comment
Question by:LFMSupport
  • 3
  • 2
5 Comments
 
LVL 9

Accepted Solution

by:
lojk earned 500 total points
ID: 16898828
this is fine, in fact ive spent much time in the past messing about with RASAPI and i believe making connections is still best done in there...

However i soon stopped bothering once i realised i can shell out (on 2000 and above) a

cmd /c Rasdial "Connectionname To Dial" Username Password

command. Saved me many an hour going mad in the RASAPI bubble.

go command prompt and do a rasdial /? for even more options...

hth

0
 
LVL 9

Expert Comment

by:lojk
ID: 16898831
I suppose that should read...

cmd /c Rasdial "Connectionname To Dial" "Username" "Password"

Also, just running Rasdial Lists all current Dialup/VPN connections...

0
 
LVL 1

Author Comment

by:LFMSupport
ID: 16900802
I could make that work.

Thanks mate.
0
 
LVL 9

Expert Comment

by:lojk
ID: 16900848
RASAPI is an unpleasant place indeed and its actually quite difficult to control the Windows Interface side of it, you usually end up making your own RAS dialer and calling the connection which is not wholly dissimilar to doing a Rasdial (just means you lose any Win9x compatability)...

If I've saved just *one* tuft of your hair then I'm happy... Thx for points...
0
 
LVL 1

Author Comment

by:LFMSupport
ID: 16901795
You have ;-)

Do you have any idea which parameter/property enables you to show the icon inthe tray when connection??
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now