Jump to content

HttpWebRequest the spaces are not preserved


Recommended Posts

Hi, In this code

Dim email As String = "this is a test"		Dim password As String = "YOUR PASSWORD"		Dim URLAuth As String = "http://test.ca/webrequest.asp"		Dim postString As String = "inputEmailHandle=this is a test&inputPassword=" + password		Dim byteArray As Byte() = Encoding.UTF8.GetBytes(postString) 		Const contentType As String = "application/x-www-form-urlencoded"		System.Net.ServicePointManager.Expect100Continue = False		Dim cookies As New CookieContainer()		Dim webRequest__1 As HttpWebRequest = TryCast(WebRequest.Create(URLAuth), HttpWebRequest)		webRequest__1.Method = "POST"		webRequest__1.ContentType = contentType		webRequest__1.CookieContainer = cookies		webRequest__1.ContentLength = byteArray.Length		webRequest__1.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/2008070208 Firefox/3.0.1"		webRequest__1.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"		webRequest__1.AllowAutoRedirect = True		webRequest__1.Referer = "https://www.google.ca/"		Dim requestWriter As Stream = webRequest__1.GetRequestStream()		requestWriter.Write(byteArray, 0, byteArray.Length)		requestWriter.Close()		Dim resp As WebResponse = webRequest__1.GetResponse()		Response.Write(CType(resp, HttpWebResponse).StatusDescription)		requestWriter = resp.GetResponseStream() 		Dim responseReader As New StreamReader(requestWriter)		Dim responseData As String = responseReader.ReadToEnd()		Response.Write(responseData + "---")		responseReader.Close()		requestWriter.Close()		webRequest__1.GetResponse().Close()

Instead of displaying "this is a test" is displays "thisisatest"Any idea why the spaces are not preserved? Thx

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...