This project is read-only.

Unable to Connect using a RAS connection (the connection does not need username and password)

Aug 1, 2013 at 4:00 PM
1) "TATA PHOTON+" does not require a username and password.
2) When I dial it from Windows, I simply click the "connect" button in DUN folder and it gets connected.

This is the code:

Private Sub MyApplication_NetworkAvailabilityChanged(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.Devices.NetworkAvailableEventArgs) Handles Me.NetworkAvailabilityChanged
       Dim PB as RasDialer
        If e.IsNetworkAvailable = False Then

                PB = New RasDialer
                PB.EntryName = "TATA PHOTON+"
                PB.PhoneBookPath = RasPhoneBook.GetPhoneBookPath(RasPhoneBookType.AllUsers)
                PB.PhoneNumber = "#777"
                PB.Credentials = New Net.NetworkCredential("","")

            Catch ex As Exception
                Exit Sub

            End Try
        End If

End Sub

Basically, this app keeps running in the background and auto dials the connection when it disconnects. I get the following exception at the PB.Dial() portion

DotRas.RasException: The remote connection was denied because the user name and password combination you provided is not recognized, or the selected authentication protocol is not permitted on the remote access server.
at DotRas.Internal.ThrowHelper.ThrowRasException(Int32 errorCode)
at DotRas.Internal.RasHelper.Dial(String phoneBookPath, RASDIALPARAMS parameters, RASDIALEXTENSIONS extensions, RasDialFunc2 callback, RASEAPF eapOptions)
at DotRas.RasDialer.InternalDial(Boolean asynchronous)
at DotRas.RasDialer.Dial()
at Auto_Connect.My.MyApplication.MyApplication_NetworkAvailabilityChanged(Object sender, NetworkAvailableEventArgs e) in C:\Users\Vivek\Documents\Visual Studio 2010\Projects\Auto_Connect\Auto_Connect\ApplicationEvents.vb:line 33
Aug 2, 2013 at 2:50 AM
Edited Aug 2, 2013 at 2:51 AM
Let me start by saying that dialing it using Windows by just telling it to connect doesn't mean it doesn't require a username and password combination. The connection could have stored credentials made available to all users, given that the connection is in the All Users profile.

I'm going to need a bit more to go on than what you've provided if I'm going to be of any use. What release are you using, and which flavor? Which OS are you targeting? Does your connection have any special configuration to it? IE: Using EAP or IPsec security with certificates?

Edit: I just wanted to add, that exception is being thrown because Windows told DotRas that it couldn't connect for that reason.
Aug 2, 2013 at 5:04 AM
Heh, guess you were right about that. What confused me was this.


I contacted the manufacturer of the device and got the username and password as "internet" and "internet"

I must say, thank you for your prompt reply and also an apology from my side for overlooking the obvious.