473,395 Members | 2,192 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Plus is replaced with space when sending data with HttpWebRequest

(As.Net 1.1 framework!)

Hi!

So, I have problem as described in subject.

Here is source code:

Public Sub SendFormData(ByVal sUrl As String, ByVal sFormData As String) As
String

Try

Dim sbHTMLResponse As New StringBuilder

Dim byte_data As Byte() = Encoding.UTF8.GetBytes(sFormData.ToString)

Dim NewRequest As HttpWebRequest = CType(WebRequest.Create(sUrl),
HttpWebRequest)

NewRequest.Method = "POST"

NewRequest.ContentType = "application/x-www-form-urlencoded"

NewRequest.ContentLength = byte_data.Length

NewRequest.AllowAutoRedirect = False

Dim oNewRequestStream As Stream = NewRequest.GetRequestStream()

oNewRequestStream.Write(byte_data, 0, byte_data.Length)

oNewRequestStream.Close()

Catch ex As Exception

Response.Write("Exception happend!")

End Try

End Sub

I have sent this string:

sgGCXlQlpbn+rBOotb8jiZ/xVrUXBOl2kx9LGsjrmtOoazaf85A6ryXiuB+OglO6OWJ+gUT7M 4v+ilaF8kmrOP5JqxYwODcPVhI4UIbYhWeJ4JibpDxpbaf2kVL eU/0Z7iwM9XgR9ho4

Other applications (asp.net application on same server, asp.net application
on other server and php application on other server) receive this string
(please note that the '+' becomed space):

sgGCXlQlpbn rBOotb8jiZ/xVrUXBOl2kx9LGsjrmtOoazaf85A6ryXiuB OglO6OWJ gUT7M4v
ilaF8kmrOP5JqxYwODcPVhI4UIbYhWeJ4JibpDxpbaf2kVLeU/0Z7iwM9XgR9ho4

Any ideas?

Only connection I have found between '+' and space is in some old cgi
article about URL encoding where space is coded as '+'. But this is FORM
POST method... And '+' is obviously coded as space.

Thanx in advance!
Sep 11 '07 #1
3 6615
Hi Mateo,

Just .. [Using HttpUtility.UrlEncode to Encode your QueryStrings]
http://timstall.dotnetdevelopersjour...erystrings.htm
http://dotnetjunkies.com/Article/F9E...B9FE2348B.dcik

Regards, Alex
[TechBlog] http://devkids.blogspot.com

M(As.Net 1.1 framework!)
M>
MHi!
M>
MSo, I have problem as described in subject.
M>
MHere is source code:
M>
MPublic Sub SendFormData(ByVal sUrl As String, ByVal sFormData As
MString) As String
M>
MTry
M>
MDim sbHTMLResponse As New StringBuilder
M>
MDim byte_data As Byte() = Encoding.UTF8.GetBytes(sFormData.ToString)
M>
MDim NewRequest As HttpWebRequest = CType(WebRequest.Create(sUrl),
MHttpWebRequest)
M>
MNewRequest.Method = "POST"
M>
MNewRequest.ContentType = "application/x-www-form-urlencoded"
M>
MNewRequest.ContentLength = byte_data.Length
M>
MNewRequest.AllowAutoRedirect = False
M>
MDim oNewRequestStream As Stream = NewRequest.GetRequestStream()
M>
MoNewRequestStream.Write(byte_data, 0, byte_data.Length)
M>
MoNewRequestStream.Close()
M>
MCatch ex As Exception
M>
MResponse.Write("Exception happend!")
M>
MEnd Try
M>
MEnd Sub
M>
MI have sent this string:
M>
MsgGCXlQlpbn+rBOotb8jiZ/xVrUXBOl2kx9LGsjrmtOoazaf85A6ryXiuB+OglO6OWJ+g
MUT7M4v+ilaF8kmrOP5JqxYwODcPVhI4UIbYhWeJ4JibpDxpba f2kVLeU/0Z7iwM9XgR9h
Mo4
M>
MOther applications (asp.net application on same server, asp.net
Mapplication on other server and php application on other server)
Mreceive this string (please note that the '+' becomed space):
M>
MsgGCXlQlpbn rBOotb8jiZ/xVrUXBOl2kx9LGsjrmtOoazaf85A6ryXiuB OglO6OWJ
MgUT7M4v
MilaF8kmrOP5JqxYwODcPVhI4UIbYhWeJ4JibpDxpbaf2kVLeU/0Z7iwM9XgR9ho4
M>
MAny ideas?
M>
MOnly connection I have found between '+' and space is in some old cgi
Marticle about URL encoding where space is coded as '+'. But this is
MFORM POST method... And '+' is obviously coded as space.
M>
MThanx in advance!
M>
Sep 11 '07 #2
Hi Alex!

This is article aout QueryString and I cannotuse GET method, I must use FORM
POST method to send this data. I'm sending data to credit card company and
I should send them some kind of hash wich may contain plus sign. I have
server side hash calcualtion so I send those data with HttpWebRequest object
from server. When I send those data, they receive my data with spaces except
plus signs.

I', out of ideas... why should "+" be encoded as white space.... it should
be vice versa... :(
.....
Sep 11 '07 #3
forget my last post.... thanx man, this thing works!
Sep 11 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: PerryG | last post by:
We have a .NET 1.1 client which is sending a gzipped soap request using HttpWebRequest to an Apache server. The Apache server is using a the 'mod_deflate' server to decompress the incoming...
4
by: Mark | last post by:
i have a very simple web servive Imports System.Web.Services <System.Web.Services.WebService(Namespace:="urn:Example1")> _ Public Class Example1 Inherits System.Web.Services.WebService
0
by: khawar | last post by:
here is my code that i am using to send the post to verisign: using System.Drawing; using System.Data; using System.Data.SqlClient; using System.Data.OleDb; using System; using System.Web.UI;...
4
by: Christina N | last post by:
What is the easiest way to make an ASP.Net application send data to another web-app? For instance I would like APP3 to log user stats from APP1 and APP2. The applications are located on different...
2
by: Eric | last post by:
Hi, In an old eVB program, it sends data to a ASP program with this: dim xmlHTTP as XMLHTTPRequest set xmlHTTP = CreateObject("Microsoft.XMLHTTP") xmlHTTP.Open "POST", url-string, False...
0
by: sanjaygupta11 | last post by:
I am using httpwebrequest and httpwebresponse objects for sending data to remote appication by post and receiving the response from there. I am using this code in my windows application which will...
7
by: GD | last post by:
Hi, I am trying to call a webservice from a windows service application. It works only if I launch the windows service app from VS.Net 2005 (Worked around from Main()) or from a winform test...
1
by: Gene Kelley | last post by:
This has got to be an easy one, but I'm just not getting it. The following function (below) returns name=value pairs from URL queries (GET). All is working as expected, but I am trying to figure...
5
by: souporpower | last post by:
Hi All I am using ajax as follows: var parameters = "groups=" + escape(myemail+100@gmail.com); var url="/mydomain/ajaxCall"; if (req != null) { req.open("POST", url, true);
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.