473,738 Members | 3,636 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2031
You need to URLEncode the parameters. Spaces etc are not permitted in
URLs. You can use:

value = HttpUtility.Url Encode(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.Url Encode(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.Url Encode( StringToEncode ); to encode data to post

myString = "Name=" + HttpUtility.Url Encode( "doe" );
myString += "&SurName=" + HttpUtility.Url Encode( "john" );
Use HttpUtility.Url Decode( urlToDecode ); to decode data to post
in ASP.net: HttpServerUtili ty.UrlEncode

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

//NB: MyURL will be encoded as
"http%3a%2f%2fw ww.contoso.com% 2farticles.aspx %3ftitle+%3d+AS P.NET+Examples"
instead of
"http%3a%2f%2fw ww.contoso.com% 2farticles.aspx %3ftitle+=+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.Url Encode( StringToEncode ); to encode data to post

myString = "Name=" + HttpUtility.Url Encode( "doe" );
myString += "&SurName=" + HttpUtility.Url Encode( "john" );
Use HttpUtility.Url Decode( urlToDecode ); to decode data to post
in ASP.net: HttpServerUtili ty.UrlEncode

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

//NB: MyURL will be encoded as
"http%3a%2f%2fw ww.contoso.com% 2farticles.aspx %3ftitle+%3d+AS P.NET+Examples"
instead of
"http%3a%2f%2fw ww.contoso.com% 2farticles.aspx %3ftitle+=+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.******@wanad oo.fr> wrote in message
news:%2******** ********@TK2MSF TNGP15.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.Url Encode( StringToEncode ); to encode data to post

myString = "Name=" + HttpUtility.Url Encode( "doe" );
myString += "&SurName=" + HttpUtility.Url Encode( "john" );
Use HttpUtility.Url Decode( urlToDecode ); to decode data to post
in ASP.net: HttpServerUtili ty.UrlEncode

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

//NB: MyURL will be encoded as
"http%3a%2f%2fw ww.contoso.com% 2farticles.aspx %3ftitle+%3d+AS P.NET+Examples" instead of
"http%3a%2f%2fw ww.contoso.com% 2farticles.aspx %3ftitle+=+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.******@wanad oo.fr> wrote in message
news:%2******** ********@TK2MSF TNGP15.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.Url Encode( StringToEncode ); to encode data to post

myString = "Name=" + HttpUtility.Url Encode( "doe" );
myString += "&SurName=" + HttpUtility.Url Encode( "john" );
Use HttpUtility.Url Decode( urlToDecode ); to decode data to post
in ASP.net: HttpServerUtili ty.UrlEncode

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

//NB: MyURL will be encoded as
"http%3a%2f%2fw ww.contoso.com% 2farticles.aspx %3ftitle+%3d+AS P.NET+Examples" instead of
"http%3a%2f%2fw ww.contoso.com% 2farticles.aspx %3ftitle+=+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.d e
Nov 17 '05 #8
Thank you!

Peter

"Joerg Jooss" <ne********@joe rgjooss.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.d e

Nov 17 '05 #9

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

Similar topics

7
1573
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 gave up. This is in the Logon button. Sometimes it will show on just one key entry for the passwrd. But sometimes and often it wil take 2 key entries. Any ideas what this is and how to fix it. Well here it is: ...
3
1693
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. Can anyone help? The code I am using is :-
13
9820
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 response.GetResponseStream() also empty. However, I am able to open the URL in the browser (the URL address remains the same; it is not redirected) Here is the code snippet: HttpWebRequest req = (HttpWebRequest)WebRequest.Create(pageAddress);
5
1329
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, 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:
6
1968
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 able to help me. Here is the code that i am using: Dim url As String = "MyIP" Dim httpRequest As HttpWebRequest = CType(WebRequest.Create(url),
1
2980
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! The invalid characters are: ef bb bf, at the top of the stream, which are . Why is this occuring, I am totally baffled by this? Here is the stream:
3
2084
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) I want to erase and merely re-write the same character(s) using a brush whose foreground color is the same as the background color. The following code does that: protected override void OnPaint(PaintEventArgs pea) { Graphics grfx =...
3
4881
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 responses as quickly as possible, then do it again. For my last attempt, I tried implementing a circular queue of precreated HttpWebRequest objects, then creating a HttpWebResponse, StreamReader, and Stream and disposing of them after usage. My...
4
2565
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 code is handling the conversion of RTF text characters and utf characters into HTML entities (e.g. & is being converted to &amp; by the inbuilt php function 'htmlentities')
0
8788
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
9335
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
9263
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
8210
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
6751
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...
0
6053
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4570
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2745
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2193
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.