shahab_ksh
دوشنبه 02 خرداد 1390, 17:06 عصر
با سلام
ایراد این کد چیه که اطلاعات رو به این فرم ارسال نمیکنه؟
http://www.shahab.kermanshahweb.com/us.aspx
Dim request As HttpWebRequest
Dim response As HttpWebResponse = Nothing
Dim reader As StreamReader
Dim address As Uri
Dim data As StringBuilder
Dim byteData() As Byte
Dim postStream As Stream = Nothing
address =
New Uri("http://www.shahab.kermanshahweb.com/us.aspx")
' Create the web request
request =
DirectCast(WebRequest.Create(address), HttpWebRequest)
' Set type to POST
request.Method =
"POST"
request.ContentType =
"application/x-www-form-urlencoded"
' Create the data we want to send
data =
New StringBuilder()
data.Append(
"name=" + HttpUtility.UrlEncode("value1", Encoding.UTF8))
data.Append(
"tm=" + HttpUtility.UrlEncode("value2", Encoding.UTF8))
data.Append(
"ms=" + HttpUtility.UrlEncode("value3", Encoding.UTF8))
data.Append(
"b1=" + HttpUtility.UrlEncode("Submit", Encoding.UTF8))
data.Append(
"__VIEWSTATE=" + HttpUtility.UrlEncode("/wEPDwUKMTQ0MjI0NDcxNWRkKwuVGlQj7Mv+oge8Y0YfodnQyp8 =", Encoding.UTF8))
data.Append(
"__EVENTVALIDATION=" + HttpUtility.UrlEncode("/wEWBQKh4/e0BAL7uPQdAszvtu8MAsPv3u8MAr7v5u0MeK4X2jSLBZf1prAc AB6n94hBupA=", Encoding.UTF8))
' Create a byte array of the data we want to send
byteData =
UTF8Encoding.UTF8.GetBytes(data.ToString())
' Set the content length in the request headers
request.ContentLength = byteData.Length
' Write data
Try
postStream = request.GetRequestStream()
postStream.Write(byteData, 0, byteData.Length)
Finally
If Not postStream Is Nothing Then postStream.Close()
End Try
Try
' Get response
response =
DirectCast(request.GetResponse(), HttpWebResponse)
' Get the response stream into a reader
reader =
New StreamReader(response.GetResponseStream())
' Console application output
TextBox1.Text = reader.ReadToEnd()
Finally
If Not response Is Nothing Then response.Close()
End Try
ایراد این کد چیه که اطلاعات رو به این فرم ارسال نمیکنه؟
http://www.shahab.kermanshahweb.com/us.aspx
Dim request As HttpWebRequest
Dim response As HttpWebResponse = Nothing
Dim reader As StreamReader
Dim address As Uri
Dim data As StringBuilder
Dim byteData() As Byte
Dim postStream As Stream = Nothing
address =
New Uri("http://www.shahab.kermanshahweb.com/us.aspx")
' Create the web request
request =
DirectCast(WebRequest.Create(address), HttpWebRequest)
' Set type to POST
request.Method =
"POST"
request.ContentType =
"application/x-www-form-urlencoded"
' Create the data we want to send
data =
New StringBuilder()
data.Append(
"name=" + HttpUtility.UrlEncode("value1", Encoding.UTF8))
data.Append(
"tm=" + HttpUtility.UrlEncode("value2", Encoding.UTF8))
data.Append(
"ms=" + HttpUtility.UrlEncode("value3", Encoding.UTF8))
data.Append(
"b1=" + HttpUtility.UrlEncode("Submit", Encoding.UTF8))
data.Append(
"__VIEWSTATE=" + HttpUtility.UrlEncode("/wEPDwUKMTQ0MjI0NDcxNWRkKwuVGlQj7Mv+oge8Y0YfodnQyp8 =", Encoding.UTF8))
data.Append(
"__EVENTVALIDATION=" + HttpUtility.UrlEncode("/wEWBQKh4/e0BAL7uPQdAszvtu8MAsPv3u8MAr7v5u0MeK4X2jSLBZf1prAc AB6n94hBupA=", Encoding.UTF8))
' Create a byte array of the data we want to send
byteData =
UTF8Encoding.UTF8.GetBytes(data.ToString())
' Set the content length in the request headers
request.ContentLength = byteData.Length
' Write data
Try
postStream = request.GetRequestStream()
postStream.Write(byteData, 0, byteData.Length)
Finally
If Not postStream Is Nothing Then postStream.Close()
End Try
Try
' Get response
response =
DirectCast(request.GetResponse(), HttpWebResponse)
' Get the response stream into a reader
reader =
New StreamReader(response.GetResponseStream())
' Console application output
TextBox1.Text = reader.ReadToEnd()
Finally
If Not response Is Nothing Then response.Close()
End Try