473,396 Members | 2,011 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,396 software developers and data experts.

Some characters causing problems in HttpWebRequest

Hello,

I've created the domain registration system in ASP.NET. I'm using
HttpWebRequest to post the data to the registrar's server. So in the Post
string I'm passing the data like name, address, phone number etc.

The only two fields that are causing problems are the phone and fax fields.
My only guess here is that's because they start with the "+" sign. So the
string looks like this:

strPost=".....&phone=+7 095 2323344&fax=+7 095 7678899&......"

I guess the combination "=+" doesn't work.

The problem is that I must start any phone number with the "+" sign,
otherwise the registrar's system won't accept it. Any substitutes like
Chr(43) do not help here.

Is there a way to deal with this issue? I guess I should be able to pass any
string, but I had no luck so far.

I would greatly appreciate any help.

Thank you,

--
Peter Afonin
Nov 17 '05 #1
8 2016
You need to URLEncode the parameters. Spaces etc are not permitted in
URLs. You can use:

value = HttpUtility.UrlEncode(value)

to do the necessary conversions.

Kulgan.

Nov 17 '05 #2
You need to URLEncode the parameters. Spaces etc are not permitted in
URLs. You can use:

value = HttpUtility.UrlEncode(value)

to do the necessary conversions.

Kulgan.

Nov 17 '05 #3
Hi,

Some characters have special meanings and would cause confusion in a URL
which may result in the data being misinterpreted.
URL encoding is a way of providing a code to represent the textual

Use HttpUtility.UrlEncode( StringToEncode ); to encode data to post

myString = "Name=" + HttpUtility.UrlEncode( "doe" );
myString += "&SurName=" + HttpUtility.UrlEncode( "john" );
Use HttpUtility.UrlDecode( urlToDecode ); to decode data to post
in ASP.net: HttpServerUtility.UrlEncode

String MyURL;
MyURL = "http://www.contoso.com/articles.aspx?title = ASP.NET Examples";
Response.Write( "<A HREF = " + Server.UrlEncode(MyURL) + "> ASP.NET
Examples <br>" );

//NB: MyURL will be encoded as
"http%3a%2f%2fwww.contoso.com%2farticles.aspx%3fti tle+%3d+ASP.NET+Examples"
instead of
"http%3a%2f%2fwww.contoso.com%2farticles.aspx%3fti tle+=+ASP.NET+Examples"

Nicolas Guinet
"Peter Afonin" <pv*@speakeasy.net> a écrit dans le message de news:
uc**************@TK2MSFTNGP14.phx.gbl...
Hello,

I've created the domain registration system in ASP.NET. I'm using
HttpWebRequest to post the data to the registrar's server. So in the Post
string I'm passing the data like name, address, phone number etc.

The only two fields that are causing problems are the phone and fax
fields.
My only guess here is that's because they start with the "+" sign. So the
string looks like this:

strPost=".....&phone=+7 095 2323344&fax=+7 095 7678899&......"

I guess the combination "=+" doesn't work.

The problem is that I must start any phone number with the "+" sign,
otherwise the registrar's system won't accept it. Any substitutes like
Chr(43) do not help here.

Is there a way to deal with this issue? I guess I should be able to pass
any
string, but I had no luck so far.

I would greatly appreciate any help.

Thank you,

--
Peter Afonin

Nov 17 '05 #4
Hi,

Some characters have special meanings and would cause confusion in a URL
which may result in the data being misinterpreted.
URL encoding is a way of providing a code to represent the textual

Use HttpUtility.UrlEncode( StringToEncode ); to encode data to post

myString = "Name=" + HttpUtility.UrlEncode( "doe" );
myString += "&SurName=" + HttpUtility.UrlEncode( "john" );
Use HttpUtility.UrlDecode( urlToDecode ); to decode data to post
in ASP.net: HttpServerUtility.UrlEncode

String MyURL;
MyURL = "http://www.contoso.com/articles.aspx?title = ASP.NET Examples";
Response.Write( "<A HREF = " + Server.UrlEncode(MyURL) + "> ASP.NET
Examples <br>" );

//NB: MyURL will be encoded as
"http%3a%2f%2fwww.contoso.com%2farticles.aspx%3fti tle+%3d+ASP.NET+Examples"
instead of
"http%3a%2f%2fwww.contoso.com%2farticles.aspx%3fti tle+=+ASP.NET+Examples"

Nicolas Guinet
"Peter Afonin" <pv*@speakeasy.net> a écrit dans le message de news:
uc**************@TK2MSFTNGP14.phx.gbl...
Hello,

I've created the domain registration system in ASP.NET. I'm using
HttpWebRequest to post the data to the registrar's server. So in the Post
string I'm passing the data like name, address, phone number etc.

The only two fields that are causing problems are the phone and fax
fields.
My only guess here is that's because they start with the "+" sign. So the
string looks like this:

strPost=".....&phone=+7 095 2323344&fax=+7 095 7678899&......"

I guess the combination "=+" doesn't work.

The problem is that I must start any phone number with the "+" sign,
otherwise the registrar's system won't accept it. Any substitutes like
Chr(43) do not help here.

Is there a way to deal with this issue? I guess I should be able to pass
any
string, but I had no luck so far.

I would greatly appreciate any help.

Thank you,

--
Peter Afonin

Nov 17 '05 #5
Hello,

Thank you all very much for your suggestions. I'll try them.

But what would happen with the spaces, for instance, in the address? They
are not allowed. I guess they also will be encoded?

Peter

"Nicolas Guinet" <n.******@wanadoo.fr> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Hi,

Some characters have special meanings and would cause confusion in a URL
which may result in the data being misinterpreted.
URL encoding is a way of providing a code to represent the textual

Use HttpUtility.UrlEncode( StringToEncode ); to encode data to post

myString = "Name=" + HttpUtility.UrlEncode( "doe" );
myString += "&SurName=" + HttpUtility.UrlEncode( "john" );
Use HttpUtility.UrlDecode( urlToDecode ); to decode data to post
in ASP.net: HttpServerUtility.UrlEncode

String MyURL;
MyURL = "http://www.contoso.com/articles.aspx?title = ASP.NET Examples";
Response.Write( "<A HREF = " + Server.UrlEncode(MyURL) + "> ASP.NET
Examples <br>" );

//NB: MyURL will be encoded as
"http%3a%2f%2fwww.contoso.com%2farticles.aspx%3fti tle+%3d+ASP.NET+Examples" instead of
"http%3a%2f%2fwww.contoso.com%2farticles.aspx%3fti tle+=+ASP.NET+Examples"

Nicolas Guinet
"Peter Afonin" <pv*@speakeasy.net> a écrit dans le message de news:
uc**************@TK2MSFTNGP14.phx.gbl...
Hello,

I've created the domain registration system in ASP.NET. I'm using
HttpWebRequest to post the data to the registrar's server. So in the Post string I'm passing the data like name, address, phone number etc.

The only two fields that are causing problems are the phone and fax
fields.
My only guess here is that's because they start with the "+" sign. So the string looks like this:

strPost=".....&phone=+7 095 2323344&fax=+7 095 7678899&......"

I guess the combination "=+" doesn't work.

The problem is that I must start any phone number with the "+" sign,
otherwise the registrar's system won't accept it. Any substitutes like
Chr(43) do not help here.

Is there a way to deal with this issue? I guess I should be able to pass
any
string, but I had no luck so far.

I would greatly appreciate any help.

Thank you,

--
Peter Afonin


Nov 17 '05 #6
Hello,

Thank you all very much for your suggestions. I'll try them.

But what would happen with the spaces, for instance, in the address? They
are not allowed. I guess they also will be encoded?

Peter

"Nicolas Guinet" <n.******@wanadoo.fr> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Hi,

Some characters have special meanings and would cause confusion in a URL
which may result in the data being misinterpreted.
URL encoding is a way of providing a code to represent the textual

Use HttpUtility.UrlEncode( StringToEncode ); to encode data to post

myString = "Name=" + HttpUtility.UrlEncode( "doe" );
myString += "&SurName=" + HttpUtility.UrlEncode( "john" );
Use HttpUtility.UrlDecode( urlToDecode ); to decode data to post
in ASP.net: HttpServerUtility.UrlEncode

String MyURL;
MyURL = "http://www.contoso.com/articles.aspx?title = ASP.NET Examples";
Response.Write( "<A HREF = " + Server.UrlEncode(MyURL) + "> ASP.NET
Examples <br>" );

//NB: MyURL will be encoded as
"http%3a%2f%2fwww.contoso.com%2farticles.aspx%3fti tle+%3d+ASP.NET+Examples" instead of
"http%3a%2f%2fwww.contoso.com%2farticles.aspx%3fti tle+=+ASP.NET+Examples"

Nicolas Guinet
"Peter Afonin" <pv*@speakeasy.net> a écrit dans le message de news:
uc**************@TK2MSFTNGP14.phx.gbl...
Hello,

I've created the domain registration system in ASP.NET. I'm using
HttpWebRequest to post the data to the registrar's server. So in the Post string I'm passing the data like name, address, phone number etc.

The only two fields that are causing problems are the phone and fax
fields.
My only guess here is that's because they start with the "+" sign. So the string looks like this:

strPost=".....&phone=+7 095 2323344&fax=+7 095 7678899&......"

I guess the combination "=+" doesn't work.

The problem is that I must start any phone number with the "+" sign,
otherwise the registrar's system won't accept it. Any substitutes like
Chr(43) do not help here.

Is there a way to deal with this issue? I guess I should be able to pass
any
string, but I had no luck so far.

I would greatly appreciate any help.

Thank you,

--
Peter Afonin


Nov 17 '05 #7
Peter Afonin wrote:
Hello,

Thank you all very much for your suggestions. I'll try them.

But what would happen with the spaces, for instance, in the address?
They are not allowed. I guess they also will be encoded?


Sure.

Cheers,

--
http://www.joergjooss.de
mailto:ne********@joergjooss.de
Nov 17 '05 #8
Thank you!

Peter

"Joerg Jooss" <ne********@joergjooss.de> wrote in message
news:xn****************@msnews.microsoft.com...
Peter Afonin wrote:
Hello,

Thank you all very much for your suggestions. I'll try them.

But what would happen with the spaces, for instance, in the address?
They are not allowed. I guess they also will be encoded?


Sure.

Cheers,

--
http://www.joergjooss.de
mailto:ne********@joergjooss.de

Nov 17 '05 #9

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

Similar topics

7
by: George Hester | last post by:
Best done using Microsoft Internet Explorer but I believe Netscape may do OK not sure. I have one itsy bitsy little problem here. The tabbing? No forget that I got a few gray hairs with that and...
3
by: Adam Stirk | last post by:
Hi, I am trying to download a image that is generated by PHP using HttpWebRequest, I believe the server uses cookies to generate the image, but I keep getting the error image from the server. ...
13
by: Jason Manfield | last post by:
For some URLs (e.g.http://v3.espacenet.com/origdoc?DB=EPODOC&IDX=WO2005028634&F=0&QPN=WO2005028634), the content length for the HttpWebResponse I get with request.GetResponse in empty. The...
5
by: Peter Afonin | last post by:
Hello, I've created the domain registration system in ASP.NET. I'm using HttpWebRequest to post the data to the registrar's server. So in the Post string I'm passing the data like name, address,...
6
by: Oliver | last post by:
I have a very wired problem requesting one specific url from within my application. I have struggeled with this for 5 hours now, and searched google withour any luck, so i hope that someone are...
1
by: romiko2000 | last post by:
Hi Folks, I got a weird problem, I create an XMLWriter to post a document via the webrequest stream and after running a network trace, I notice the data is prefixed with 3 invalid characters! ...
3
by: =?Utf-8?B?UmF5IE1pdGNoZWxs?= | last post by:
I'm drawing text using the DrawString method. I need a way to go back and erase one or more characters. As a first thought it seemed that one way to do it would be to go back to the character(s)...
3
by: matadon | last post by:
Hi, I am writing a C# app. I have a finite (~50) set of URLs that I am continuously polling in a circular manner. I would like to do this in a way that can send out each of the requests and get...
4
by: BG Mahesh | last post by:
hi We are using the normal html controls (textarea) in the posting form. The form page has the utf-8 character set. Users are copying the text from MS Word or Openoffice doc etc. Our PHP...
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
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
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...
0
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,...

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.