httpwebrequest requeststream

  • Thread starter Thread starter Guest
  • Start date Start date
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.
 
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,
 
Back
Top