How to dial VPN connection ?

Apr 30, 2009 at 5:40 PM
Edited Apr 30, 2009 at 5:41 PM
Hello im new here and i need some help pls.

Fisrt excuse my bad english.

Well i have check an example allready. But im not very clever from it. Im writing appz in vb.net and its not really clear for me. All i need is estabilshed VPN connection by VB.net. 
My problem is where should be store information about connection as IP , name and pass ? In that example are only variables like Can anyone write some better example with this variables, where u just replace IP with your ip and so on ??? Im sure it would be very helpfull for many beginners. There is so many open questions like "should i only creat a new book and use credentials.Domain and so on or many other things ...."
I hope all this make any sence to you.

Im sorry if my message is stupid.

Thank you Michael
Apr 30, 2009 at 6:27 PM
Hello

i was able to found how to set credentials :

  Dim credentials As NetworkCredential = entry.GetCredentials()
                    credentials.Domain = "dnsname"
                    credentials.Password = "passs"
                    credentials.UserName = "username"


but when im trying to to dial im getting Throw expection . What im missing ????
Please help ?
Coordinator
Apr 30, 2009 at 10:41 PM
This project isn't targetting beginners. Working with the RAS functionality in Windows would need at least an intermediate skill level with .NET, regardless of which language you've chosen for yourself. If you do not know what you're doing, you could cause problems with your computer if you are not careful.

"My problem is where should be store information about connection as IP , name and pass ?"

How the information is stored depends completely on where you create the entry. If the entry has already been created through Windows, all you need to do is use the RasDialer component to dial the connection. If you are trying to create the entry yourself, I would suggest using the static (shared) methods on the RasEntry class CreateVpnEntry.

I would suggest looking at the YouTube video channel that's linked on the Home page of this project, it might help you get started. The example was done in C#, but the only difference between the languages is the syntax.

"There is so many open questions like should i only creat a new book and use credentials.Domain and so on or many other things"

This seems to be a two part question:
A) You must create a new phone book before you can open it up to modify the contents of the file.
B) Your credentials are assigned to you by a network administrator, if you don't know what your credentials are there isn't anything I can do about that.

You do not need to retrieve the credentials object so you can set them...

Dim credentials As New NetworkCredential("username", "passs", "dnsname")

That would have worked just as well. GetCredentials attempts to retrieve the stored credentials from Windows for that particular entry, it has nothing to do with setting credentials.

"but when im trying to to dial im getting Throw expection . What im missing ????"

The Dial method on RasDialer reports failure of connection attempts by throwing an exception. If you use the DialAsync method and use the events that are raised, the errors will be returned in the DialCompleted event.