This project is read-only.

Save Password after creating VPN without Prompt

May 2, 2011 at 8:13 PM

Hi, i wrote something to create a vpn with credentials already known in the system, so i dont need the CredentialPromptDialog.

Besides that, it's not saving the password when the user open that connection again.

What i did:

Me.AllUsersPhoneBook.Open(False)
Dim conexao As RasEntry = RasEntry.CreateVpnEntry(Me.lblNomeCliente.Text, Me.txtEnderecoVPN.Text, RasVpnStrategy.Default, RasDevice.GetDeviceByName("(PPTP)", RasDeviceType.Vpn))
Me.AllUsersPhoneBook.Entries.Add(conexao)
Me.Dialer.EntryName = Me.lblNomeCliente.Text
Me.Dialer.PhoneBookPath = RasPhoneBook.GetPhoneBookPath(RasPhoneBookType.AllUsers)
Me.Dialer.Credentials = New NetworkCredential(Me.txtUsuarioVPN.Text, Me.txtSenhaVPN.Text)
Me.connectionHandle = Me.Dialer.DialAsync()
'waiting for the connection
While Me.Dialer.IsBusy
End While
Dim connection As RasConnection = RasConnection.GetActiveConnectionByHandle(Me.connectionHandle)
If (connection IsNot Nothing) Then
connection.HangUp()
End If

With this i can create the conection in the phonebook, connect and disconect but only the username is saved when i open the conection again using the windowns app

How can i solve this ?
 



May 3, 2011 at 2:47 PM

Hello again, if some is having the same issue, i solved it by putting a rasEntry.UpdateCredentials(networkCredentials, True)

May 4, 2011 at 3:43 AM

The CredentialPromptDialog only shows the standard user interface available within Windows, getting that information into the phonebook or whatever they had showed it for is the responsibility of the developer. There's also an AutoUpdateCredentials property on RasDialer that will store credentials in the phonebook automatically upon successful completion of a connection attempt.