post url and get no response

samer_ali

Newcomer
Joined
Feb 16, 2004
Messages
11
Hello,

Well this sounds stupied question
it this function i can post url with some params but i dont want to recieve the stream back?
i just want to send it and with no response " i mean i dont want to recieve the html"

can i do this?

Function readHtmlPage(ByVal url As String, ByVal params As String) As String
Dim result As String = ""
Dim myWriter As StreamWriter

Dim objRequest As HttpWebRequest = WebRequest.Create(url)
objRequest.Method = "POST"
objRequest.ContentLength = params.Length
objRequest.ContentType = "application/x-www-form-urlencoded"
objRequest.KeepAlive = False
'objRequest.GetRequestStream()

Try
myWriter = New StreamWriter(objRequest.GetRequestStream())
myWriter.Write(params)
Catch e As Exception
Return e.Message
Finally
myWriter.Close()
End Try

Dim objResponse As HttpWebResponse = objRequest.GetResponse()
Dim sr As StreamReader
sr = New StreamReader(objResponse.GetResponseStream())
result = sr.ReadToEnd()
sr.Close()

myWriter.Close()

Return result
End Function

thanks
 
Back
Top