Thanks for your reply, Richard however I believe I am writing to the body, here is my code:
Private Shared Function PostIt(ByVal baseUrl As String, ByVal input As String) As String
Dim responseString As String
Dim request As HttpWebRequest
Dim response As HttpWebResponse = Nothing
Dim reader As StreamReader
Dim byteData() As Byte
Dim postStream As Stream = Nothing
request = DirectCast(WebRequest.Create(baseUrl + input), HttpWebRequest)
' Set type to POST
request.Method = "POST"
request.ContentType = "application/x-www-form-urlencoded"
' Create a byte array of the data we want to send
byteData = UTF8Encoding.UTF8.GetBytes(input)
' Set the content length in the request headers
request.ContentLength = byteData.Length
Try
postStream = request.GetRequestStream()
postStream.Write(byteData, 0, byteData.Length)
Finally
If Not postStream Is Nothing Then postStream.Close()
End Try
Try
' Get response
'(CRASHES HERE) response = DirectCast(request.GetResponse(), HttpWebResponse) '(CRASHES HERE)
' Get the response stream into a reader
reader = New StreamReader(response.GetResponseStream())
responseString = reader.ReadToEnd
Catch
Finally
If Not response Is Nothing Then response.Close()
End Try
Return responseString
End Function