╭∩╮(︶_︶)╭∩╮) 
我还想问为什么我F1不能打开自动打开MSDN呢! :)

解决方案 »

  1.   

    public bool Login(string Name,string Password)
    {
    string header = rda.Logon("http://www.csdn.net/member/logon.asp",Name,Password);
    if(header != null)
    {
    aspsessionid = header;
    hasLogin = true;
    return true;
    }
    else
    {
    hasLogin = false;
    return false;
    }
    }
    public string Logon(string Url,string Name,string Password)
    {
    UTF8Encoding encoding = new UTF8Encoding();
    WebClient myWebClient = new WebClient();
    NameValueCollection myNameValueCollection = new NameValueCollection();
    myNameValueCollection.Add("name", Encoding.Default.GetString(encoding.GetBytes(Name)));
    myNameValueCollection.Add("pass",Password);
    myNameValueCollection.Add("type","0"); string header = ""; byte[] responseArray = myWebClient.UploadValues(Url,"POST",myNameValueCollection); header = myWebClient.ResponseHeaders[4].ToString() + "\n"; string content = Encoding.Default.GetString(responseArray); if(content.Length > 0)
                    return null;
    else
    return header;
    }