I send a request from one project in solution to another:
WebRequest request = WebRequest.Create(UrlTemplate);
request.Timeout = 500000;
request.Method = WebRequestMethods.Http.Post;
request.ContentType = ContentType;
byte[] postData = System.Text.Encoding.ASCII.GetBytes(data);
request.ContentLength = postData.Length;
Stream newStream = request.GetRequestStream();
// Send the data.
newStream.Write(postData, 0, postData.Length);
newStream.Flush();
newStream.Close();
Well, in the function that is set in UrlTemplate
I get the correct string, (which I send in the data), but the problem starts when the string contains special characters.
If the string is: 12&34
What I get in the function is: 12
.
If the string is: 12+34
What I get in the function is: 12 34
.
I'll be glad to know if it has happened to some of you and how you solved it. Thank in advance.
Use System.Web.HttpUtility.UrlEncode
or System.Net.WebUtility.UrlEncode
while forming UrlTemplate
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With