Solved

Creating VPN Connection from VB with user credentials

Posted on 2006-06-13
5
855 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

738 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