- Код: Выделить всё
Dim Data as string
Dim sResult As String
'Dim oHttp As HttpWebRequest
Dim objResponse As WebResponse
Dim objRequest As WebRequest = System.Net.HttpWebRequest.Create(arg2)
objRequest = System.Net.HttpWebRequest.Create(arg2)
With objRequest
.Method = "GET" '#Запрос методом GET
.Timeout = 20000 '#20 секунд таймаут
End With
objResponse = objRequest.GetResponse
Dim sr As System.IO.StreamReader = New System.IO.StreamReader(objResponse.GetResponseStream(), System.Text.Encoding.GetEncoding("windows-1251"))
sResult = sr.ReadToEnd()
' Close and clean up the StreamReader
sr.Close()
Data = sResult
То как добавить к запросу строки Keep Alive и юзер-агент?