Using HTTP Request and Response

  • Thread starter Thread starter Alfred Sahayam
  • Start date Start date
A

Alfred Sahayam

Can anybody tell me as how should I use the HTTP resuest and response in the
VB .Net. I need it urgently. If possible, please explain with sample.

Thanks in advance,,
Alfred
 
* "Alfred Sahayam said:
Can anybody tell me as how should I use the HTTP resuest and response in the
VB .Net. I need it urgently. If possible, please explain with sample.

\\\
Public Function LoadTextFile(ByVal Url As String) As String
Dim wrq As WebRequest = WebRequest.Create(Url)
Dim wrp As HttpWebResponse = _
DirectCast(wrq.GetResponse(), HttpWebResponse)
Dim sr As StreamReader = _
New StreamReader(wrp.GetResponseStream)
Dim Text As String = sr.ReadToEnd()
sr.Close()
wrp.Close()
Return Text
End Function
///
 
My interest was tweaked when I saw this code so thought I'd have a play.
I'm getting the errors saying...
WebRequest, HttpWebResponse and StreamReader are not defined.
What namespace do I need to import to get these to be recognised?
I tried system.web but no change.

Jay
 
Not to worry, found my own answers.
system.net and system.IO were needed.

Jay

Jay said:
My interest was tweaked when I saw this code so thought I'd have a play.
I'm getting the errors saying...
WebRequest, HttpWebResponse and StreamReader are not defined.
What namespace do I need to import to get these to be recognised?
I tried system.web but no change.

Jay


in
 
Back
Top