if (sUser != String.Empty)
{
oCredential = new NetworkCredential(sUser, sPwd, sDomain);
oRequest.Credentials = oCredential.GetCredential(new Uri(uri), String.Empty);
}
else
{
oRequest.Credentials = CredentialCache.DefaultCredentials;
}
StreamReader sr = new StreamReader(oRequest.GetResponse().GetResponseStream(), System.Text.Encoding.Default);
string line = sr.ReadToEnd();
sr.Close();
if (line.IndexOf("LAN口状态") > -1)//登录成功
{
Console.WriteLine("断开登录成功");
}
else
{
Console.WriteLine("断开登录失败");
}
}
}
新闻热点
疑难解答