传输cookie
通过#的httpwebrequest,发送http报文。
public Stream getResponse(CookieContainer cookies)
{
HttpWebRequest request;
if (postData != "")
{
string str = @url + "?" + @postData;
request = (HttpWebRequest)WebRequest.Create(@str);
}
else
{
request = (HttpWebRequest)WebRequest.Create(@url);
}
request.CookieContainer = cookies;
request.Credentials = CredentialCache.DefaultCredentials;
request.Accept = @"*/*";
request.Host = host;
request.Method = "GET";
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream responseStream = response.GetResponseStream();
return responseStream;
}