日期:2014-05-18 浏览次数:21270 次
FileOprate Filetemp = new FileOprate();
string strId = "admin";//用户名
string strPassword = "123456";//密码
//string strsubmit = "YES";
ASCIIEncoding encoding = new ASCIIEncoding();
string postData = "edtUserName=" + strId;
postData += ("&edtPassWord=" + strPassword);
postData += "&edtSaveDate=&edtCheckOut=";
//postData += ("&Accept=" + strsubmit);
byte[] data = encoding.GetBytes(postData);
// Prepare web request...
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create("http://www.oqlk.cn/login.asp");
myRequest.Method = "POST";
myRequest.ContentType = "application/x-www-form-urlencoded";
myRequest.ContentLength = data.Length;
Stream newStream = myRequest.GetRequestStream();
// Send the data.
newStream.Write(data, 0, data.Length);
newStream.Close();
// Get response
HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse();
StreamReader reader = new StreamReader(myResponse.GetResponseStream(), Encoding.UTF8);
string content = reader.ReadToEnd();
//Response.Write(content);
textBox1.Text = content;
Filetemp.SaveFile(content, "1", "back");