473,732 Members | 2,210 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(By Val sUrl As String, ByVal sFormData As String) As
String

Try

Dim sbHTMLResponse As New StringBuilder

Dim byte_data As Byte() = Encoding.UTF8.G etBytes(sFormDa ta.ToString)

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

NewRequest.Meth od = "POST"

NewRequest.Cont entType = "applicatio n/x-www-form-urlencoded"

NewRequest.Cont entLength = byte_data.Lengt h

NewRequest.Allo wAutoRedirect = False

Dim oNewRequestStre am As Stream = NewRequest.GetR equestStream()

oNewRequestStre am.Write(byte_d ata, 0, byte_data.Lengt h)

oNewRequestStre am.Close()

Catch ex As Exception

Response.Write( "Exception happend!")

End Try

End Sub

I have sent this string:

sgGCXlQlpbn+rBO otb8jiZ/xVrUXBOl2kx9LGs jrmtOoazaf85A6r yXiuB+OglO6OWJ+ gUT7M4v+ilaF8km rOP5JqxYwODcPVh I4UIbYhWeJ4Jibp Dxpbaf2kVLeU/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/xVrUXBOl2kx9LGs jrmtOoazaf85A6r yXiuB OglO6OWJ gUT7M4v
ilaF8kmrOP5JqxY wODcPVhI4UIbYhW eJ4JibpDxpbaf2k VLeU/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 6635
Hi Mateo,

Just .. [Using HttpUtility.Url Encode 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(By Val 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.G etBytes(sFormDa ta.ToString)
M>
MDim NewRequest As HttpWebRequest = CType(WebReques t.Create(sUrl),
MHttpWebRequest )
M>
MNewRequest.Met hod = "POST"
M>
MNewRequest.Con tentType = "applicatio n/x-www-form-urlencoded"
M>
MNewRequest.Con tentLength = byte_data.Lengt h
M>
MNewRequest.All owAutoRedirect = False
M>
MDim oNewRequestStre am As Stream = NewRequest.GetR equestStream()
M>
MoNewRequestStr eam.Write(byte_ data, 0, byte_data.Lengt h)
M>
MoNewRequestStr eam.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+rB Ootb8jiZ/xVrUXBOl2kx9LGs jrmtOoazaf85A6r yXiuB+OglO6OWJ+ g
MUT7M4v+ilaF8km rOP5JqxYwODcPVh I4UIbYhWeJ4Jibp Dxpbaf2kVLeU/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/xVrUXBOl2kx9LGs jrmtOoazaf85A6r yXiuB OglO6OWJ
MgUT7M4v
MilaF8kmrOP5Jqx YwODcPVhI4UIbYh WeJ4JibpDxpbaf2 kVLeU/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
3235
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 message, and to also compress the response (GZIP). The mod_deflate filter requires the 'Content-Length' header contained within the incoming request to specify the number of UNCOMPRESSED bytes being sent and not the actual bytes of the body of the...
4
7882
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
1392
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; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls;
4
1642
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 IIS servers. Put in another way, can I send a datastring to another web-app without having the IE client expecting a post back from that server? Best regards, Christina
2
1446
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 xmlHTTP.Send result = xmlHTTP.ResponseText
0
1528
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 send a request to remote application. --------------------------------------------------------------------------------------------------------------- string lcUrl = "http://localhost/check/WebSite3/Default.aspx"; HttpWebRequest loHttp...
7
10867
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 application. However, it generates a kind of security error after I install and start the service in my Window Server machine. I believe that it is related to authentication. The following is the sample code: HttpWebRequest obj =...
1
13709
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 out how to remove the + (plus signs) from the values that contain spaces. I'm trying to use the String Object's replace() method to accomplish this. This is what I've tried so far along with the results:
5
9087
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
8774
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9447
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9307
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9235
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8186
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6735
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
3261
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2180
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.