最近写了一个程序 里面有个ADSL拨号的问题。我是用最简单的方法实现就是调用系统CMD命令。
但是发现有问题,动不动程序就崩溃了。也不提示异常自动消失了。而且还是不定时崩溃。感觉好像是拨号的问题。 string syspath = Environment.GetFolderPath(Environment.SpecialFolder.System); string args = string.Format(@"{0} /d", configinfo.adslname);
if (stat == 2)
{
ProcessStartInfo myProcess = new ProcessStartInfo(syspath + @"\RASDIAL.exe", args); myProcess.CreateNoWindow = true; myProcess.UseShellExecute = false; Process.Start(myProcess).WaitForExit();
Thread.Sleep(int.Parse(configinfo.adsltime) * 1000);//wateing
MainForm.isconn = false;
}
if (configinfo.dslconnname.Trim().Length > 0 && configinfo.adslpwd.Trim().Length > 0)
{
args = string.Format("{0} {1} {2}", configinfo.adslname, configinfo.dslconnname, configinfo.adslpwd); ProcessStartInfo myProcess1 = new ProcessStartInfo(syspath + @"\RASDIAL.exe", args); myProcess1.CreateNoWindow = true; myProcess1.UseShellExecute = false; Process.Start(myProcess1).WaitForExit();
Thread.Sleep(int.Parse(configinfo.adsltime) * 1000);//wateing }
请问有没有其他方式拨号的?要求可以使用帐号 密码进行拨号。谢谢大家
但是发现有问题,动不动程序就崩溃了。也不提示异常自动消失了。而且还是不定时崩溃。感觉好像是拨号的问题。 string syspath = Environment.GetFolderPath(Environment.SpecialFolder.System); string args = string.Format(@"{0} /d", configinfo.adslname);
if (stat == 2)
{
ProcessStartInfo myProcess = new ProcessStartInfo(syspath + @"\RASDIAL.exe", args); myProcess.CreateNoWindow = true; myProcess.UseShellExecute = false; Process.Start(myProcess).WaitForExit();
Thread.Sleep(int.Parse(configinfo.adsltime) * 1000);//wateing
MainForm.isconn = false;
}
if (configinfo.dslconnname.Trim().Length > 0 && configinfo.adslpwd.Trim().Length > 0)
{
args = string.Format("{0} {1} {2}", configinfo.adslname, configinfo.dslconnname, configinfo.adslpwd); ProcessStartInfo myProcess1 = new ProcessStartInfo(syspath + @"\RASDIAL.exe", args); myProcess1.CreateNoWindow = true; myProcess1.UseShellExecute = false; Process.Start(myProcess1).WaitForExit();
Thread.Sleep(int.Parse(configinfo.adsltime) * 1000);//wateing }
请问有没有其他方式拨号的?要求可以使用帐号 密码进行拨号。谢谢大家
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货