This project is read-only.

RasPresharedKey

Jun 12, 2011 at 8: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

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

VpnEntry.EncryptionType = RasEncryptionType.Optional
VpnEntry.Options.RequireDataEncryption =
False
VpnEntry.UpdateCredentials(New NetworkCredential("user", "secret"))
VpnEntry.Options.ShowDialingProgress =
False
VpnEntry.Options.PreviewUserPassword = False
VpnEntry.PhoneNumber = Destination
VpnEntry.UpdateCredentials(RasPreSharedKey.Client,
"value")  
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 5:15 AM
Edited Jun 13, 2011 at 5: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!

Jeff

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.