PPPoe connection creation in c#
C#
1
Posts
1
Posters
0
Views
1
Watching
-
Hello Everyone, I want to create PPPoE Connection. I do this code but it doesn't work and i use the library DotRas (); When I run the code the error appear in the line:
(RasEntry entry = RasEntry.CreateBroadbandEntry("osama",RasDevice.GetDeviceByName("(PPPoE Osama)",RasDeviceType.PPPoE)); )
and the error is: Value cannot be null.Parameter name: device The is the Code...
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DotRas;namespace WindowsFormsApplication2
{public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1\_Click(object sender, EventArgs e) { string path; path = RasPhoneBook.GetPhoneBookPath(RasPhoneBookType.User); using (RasPhoneBook pbk = new RasPhoneBook()) { pbk.Open(path); RasEntry entry = RasEntry.CreateBroadbandEntry("osama",RasDevice.GetDeviceByName("(PPPoE Osama)",RasDeviceType.PPPoE)); // Configure any options for your entry here via entry.Options pbk.Entries.Add(entry); } using (RasDialer dialer = new RasDialer()) { dialer.EntryName = "Your Entry"; dialer.PhoneBookPath = path; dialer.Credentials = new System.Net.NetworkCredential("User", "Password"); dialer.Dial(); } } }
}
If there is another way please tell me how.
-*-*-*-*-*-*-*-*-* To Be Or Not To Be (KARFER) -*-*-*-*-*-*-*-*-*