RasPreSharedKey?

Mar 26, 2012 at 6:21 PM

Hi!

why in the downloaded program, I can not do not use "RasPreSharedKey"

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))
VpnEntry.Options.UsePreSharedKey = True
VpnEntry.Options.UseLogOnCredentials = True
PhoneBook.Entries.Add(VpnEntry)
VpnEntry.UpdateCredentials(RasPreSharedKey.Client, PresharedKey)

RasPreSharedKey.Client - function does not exist in the dll library

:(

also

VpnEntry.Options.UsePreSharedKey - function does not exist

Coordinator
Mar 27, 2012 at 3:45 AM

As stated in the SDK help documentation, RasPreSharedKey is only available on Windows XP and later, which means you need to use (at a minimum) the WINXP build.

Also, please make sure you check the documentation before asking the question, or search the discussions here before hand. This question has been asked repeatedly. Thank you for your cooperation.

Mar 27, 2012 at 6:08 PM

i have win7...

i can't build application, because

DotRas.RasEntry.UpdateCredentials(ByVal DotRas.RasPreSharedKey, ByVal String) As Boolean - function exists in the lib

but i can't use it

RasPreSharedKey is not declared, i can't create it... why?

Coordinator
Mar 27, 2012 at 6:51 PM

RasPreSharedKey is an enum, it's not something you "create". You just told me that the method exists, but you can't use it. This sounds like a problem between the chair and the keyboard, the SDK is fine.

I'm sorry, but you're on your own.

Mar 27, 2012 at 7:13 PM

Dim entry As RasEntry = RasEntry.CreateVpnEntry(EntryName, IPAddress.Loopback.ToString(), RasVpnStrategy.Default, RasDevice.GetDeviceByName("(PPTP)", RasDeviceType.Vpn))
entry.UpdateCredentials(New NetworkCredential("user", "pass")) - works perfectly [DotRas.RasEntry.UpdateCredentials(ByVal System.Net.NetworkCredential) As Boolean]

 

but

 

entry.UpdateCredentials(DotRas.RasPreSharedKey, "test") - do not work [DotRas.RasEntry.UpdateCredentials(ByVal DotRas.RasPreSharedKey, ByVal String) As Boolean] - i can't use this function, but it exists...  i do not understand, i'm so stupid :(

 

Coordinator
Mar 28, 2012 at 2:20 AM

Like I said, it's not something you create... you just need to access the member you want of the enum.

DotRas.RasPreSharedKey.Client would be what you're after.