这段代码提效数据后,没有效果,帮忙看一下错在哪里?
本帖最后由 pengwei0417 于 2012-12-01 23:07:15 编辑
Dim url As New Uri("http://110.8.64.9/tp/template.asp")
Dim myreq As HttpWebRequest
myreq = HttpWebRequest.Create(url)
myreq.Method = "POST" '设置请求方法
myreq.ContentType = "application/x-www-form-urlencoded"
'textbox2.text="questselect1=321&submit1=%de%dskksdf&cname=&iDE="
Dim datastr As String = TextBox2.Text.Trim
myreq.ContentLength = datastr.Length
Dim encoding As New ASCIIEncoding
Dim byte1 As Byte() = encoding.GetBytes(datastr)
myreq.ContentType = "application/x-www-form-urlencoded"
myreq.Headers.Add("X_FORWARDED_FOR", "10.71.12.25")
myreq.Accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*"
myreq.Referer = "http://10.82.64.9/tp/template.asp"
myreq.Headers.Add(HttpRequestHeader.AcceptLanguage, "zh-cn")
myreq.Headers.Add(HttpRequestHeader.AcceptEncoding, "gzip, deflate")
myreq.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)"
myreq.ContentLength = byte1.Length
myreq.Headers.Add(HttpRequestHeader.CacheControl, "no-cache")
myreq.Headers.Add(HttpRequestHeader.Cookie, "ASPSESSIONIDQQASCARB=IJGNFCIDILJNGLOLGEHJGAGH")
Dim newstream As Stream = myreq.GetRequestStream()
newstream.Write(byte1, 0, byte1.Length)
newstream.Close()
'响应部分
Dim myres As HttpWebResponse = myreq.GetResponse()
Dim mystream As Stream = myres.GetResponseStream
Dim srreader As New StreamReader(mystream)
TextBox3.Text = srreader.ReadToEnd