This project is read-only.

Not able to Create New "Dial Up" connection and Dial it

Aug 23, 2010 at 5:05 PM
Edited Aug 23, 2010 at 5:10 PM

I have created a new dial up connection but it is giving error that argument is null which is passed to the code

The code which i have seen for VPN connection is

RasEntry entry = RasEntry.CreateVpnEntry(EntryName, IPAddress.Loopback.ToString(), RasVpnStrategy.Default,
                RasDevice.GetDeviceByName("(PPTP)", RasDeviceType.Vpn));

 

Now i created the code similar to the above VPN. But RasVpnStrategy.default is not available for Dial Up entry. Code for the creating dial up profile is as follows. Please help me.

 private void button1_Click(object sender, EventArgs e)
        {
            this.rasPhoneBook1.Open();

//Error is shown in  the next line when i try to add the entry

            RasEntry check = RasEntry.CreateDialUpEntry("TEST PROFILE", "#777", RasDevice.GetDeviceByName("USB Wireless Modem", RasDeviceType.Modem,false));

//  Error is ArgumentNullException was unhandled

//  Value Cannot be null

//   Parameter Type: device   - I guess its the ras device which is giving error to the function.

 

            this.rasPhoneBook1.Entries.Add(check);

        }

 

 

Aug 23, 2010 at 6:01 PM

Have you verified that is the name being reported by RAS for your device?

You might want to just call RasDevice.GetDevices() while debugging and see what RAS is reporting to you for your available device names in the returned collection. It's obvious the RasDevice being returned by your call is null.

Aug 23, 2010 at 6:50 PM

Yeah Jeff,


I have checked with RasDevice.GetDevices() and it returns null value. But I want to add the device which will be connected later in the future. Cant I add any device name and create RAS entry rather than scanning the device availability.

I am creating the profile even if the device is not connected to the system. Or RasDevice.GetDevices() returns null value.

Is there any way to do that?

Aug 24, 2010 at 12:56 AM

The RasDevice class only reports any hardware that's installed in the machine, as reported by RAS. The only way around that would be to use the Create method from the 1.2 SDK under development and manually create the hardware. However, using that method will not guarantee the hardware will be available, and may cause other issues with the entry.