httpwebrequest requeststream

G

Guest

I am posting to a cgi script using httpwebrequest but I have when problems
when of the parameters in the request stream has embedded spaces.

My old asp code successfully posted using a form action with fields such as

&name="Joe Jackson"

in .NET, if I pass this to the requeststream the cgi interprets some extra
double quotes
&name=""Joe Jackson""

If I leave off the quotes entirely the CGI script fails.

Does anybody know whats the best way to build the requeststream so that it
handles double quotes and spaces.
 
J

Joerg Jooss

Dave said:
I am posting to a cgi script using httpwebrequest but I have when
problems when of the parameters in the request stream has embedded
spaces.

My old asp code successfully posted using a form action with fields
such as

&name="Joe Jackson"

in .NET, if I pass this to the requeststream the cgi interprets some
extra double quotes
&name=""Joe Jackson""

If I leave off the quotes entirely the CGI script fails.

Does anybody know whats the best way to build the requeststream so
that it handles double quotes and spaces.

You have to URL-encode the key/value pairs manually using
System.Web.HttpUtility.UrlEncode() before writing them to the request
stream.

Cheers,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top