Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Mar 31, 2012 06:32 PM by demoxx
Member
2 Points
7 Posts
Mar 29, 2012 12:08 PM|LINK
For start, sorry if this is wrong forum.
Im trying to send data from a Windows Form to an aspx page and send back a response.
Im running around in circles trying to make this work.
The data im trying to send is 4 strings.
So fare I have this in my code, using the build-in webclient in visual studio 2010, in the windows form sending to the aspx
strSendString= "v1=something1&v2=something2&v3=something3&v4=something4"
WebClient1.UploadString("http://randomdomain.com/myaspxpage.aspx", strSendString)
If I use below code, in the aspx, im able to handle POST information
Dim Param() As Byte = Request.BinaryRead(HttpContext.Current.Request.ContentLength) Dim strRequest As String = Encoding.ASCII.GetString(Param)
But if I use below code, in the aspx page, V1 and rest, is empty, why?
HttpContext.Current.Request.Form("V1")
Contributor
2114 Points
402 Posts
Mar 30, 2012 05:34 AM|LINK
try adding
webclient1.Headers["Content-type"] = "application/x-www-form-urlencoded";
before the call
Mar 31, 2012 06:32 PM|LINK
Im not sure what was wrong, but i think that what sovled it to use uploadvalues if I want to be able to access request.form values,
AND to upload a namevaluecollection and not a string.
demoxx
Member
2 Points
7 Posts
Request.Form vs Request.BinaryRead ?
Mar 29, 2012 12:08 PM|LINK
For start, sorry if this is wrong forum.
Im trying to send data from a Windows Form to an aspx page and send back a response.
Im running around in circles trying to make this work.
The data im trying to send is 4 strings.
So fare I have this in my code, using the build-in webclient in visual studio 2010, in the windows form sending to the aspx
WebClient1.UploadString("http://randomdomain.com/myaspxpage.aspx", strSendString)If I use below code, in the aspx, im able to handle POST information
But if I use below code, in the aspx page, V1 and rest, is empty, why?
HttpContext.Current.Request.Form("V1")Mauro_net
Contributor
2114 Points
402 Posts
Re: Request.Form vs Request.BinaryRead ?
Mar 30, 2012 05:34 AM|LINK
try adding
before the call
demoxx
Member
2 Points
7 Posts
Re: Request.Form vs Request.BinaryRead ?
Mar 31, 2012 06:32 PM|LINK
Im not sure what was wrong, but i think that what sovled it to use uploadvalues if I want to be able to access request.form values,
AND to upload a namevaluecollection and not a string.