WEBCLIENT 获取需要BASIC认证的网页
我看到别人是这么做的,单我的貌似不行啊
public string GetPageContent( string url)
{
WebClient myClient = new WebClient();
//myClient.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
string login =
string passwd =
string authInfo = Convert.ToBase64String(Encoding.ASCII.GetBytes(login + ":" + passwd));
myClient.Headers.Add("Authorization", "basic " + authInfo);
myClient.Credentials = CredentialCache.DefaultCredentials;