Jun 12, 2011 at 7:32 PM

Dears guru. Have a nice day. I try use DorRas 1.2 with VS 2010 but:
Private Sub CreateEntryButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CreateEntryButton.Click
Dim VpnName As String= "TunnelName"
Dim Destination As String= "vpn.server.net"
Dim PresharedKey As String= "YourSecret"
Dim PhoneBook As New  RasPhoneBook

 Dim VpnEntry As RasEntry = RasEntry.CreateVpnEntry(VpnName, Destination, DotRas.RasVpnStrategy.L2tpOnly, DotRas.RasDevice.Create(VpnName, DotRas.RasDeviceType.Vpn))
VpnEntry.Options.RemoteDefaultGateway =

VpnEntry.EncryptionType = RasEncryptionType.Optional
VpnEntry.Options.RequireDataEncryption =
VpnEntry.UpdateCredentials(New NetworkCredential("user", "secret"))
VpnEntry.Options.ShowDialingProgress =
VpnEntry.Options.PreviewUserPassword = False
VpnEntry.PhoneNumber = Destination
End Sub
And have next error:Error 1 'RasPreSharedKey' is not declared. It may be inaccessible due to its protection level.
Can anybody help me ? More thanks for future.
Best regards Ivan

Jun 13, 2011 at 4:15 AM
Edited Jun 13, 2011 at 4:16 AM

Hello Ivan,

RAS did not support the use of pre-shared keys until Windows XP (WINXP). The only reason you would get that is if you had referenced the Windows 2000 (WIN2K) version of the assembly. Just change your reference to the WINXP or later build and you should be fine.

Hope that helps!


Edit: I just wanted to add, you could use any of the build types except for the WIN2K build. WINXP, WIN2K8 and WIN7 all support the use of pre-shared keys.