samedi 29 octobre 2016

C# Web Server IO bytesarray data gets lost

I'm sending POST data through C# to a web server to create Accounts in a database, which itself works, but some chars get replaced with spaces.

I'm sending the data this way:

Webrequest request = Webrequest.Create(Url);    
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = bytesarr.Length;

System.IO.Stream streamwriter = request.GetRequestStream();
streamwriter.Write(bytesarr, 0, bytesarr.Length);
Console.WriteLine(Encoding.UTF8.GetString(bytesarr,0,bytesarr.Length));
streamwriter.Close();

The output of the bytesarray in my program is still fine, when I get the echo from the server then some things are missing like "+". I'm not escaping the string in the php form(although I tried that as well).




Aucun commentaire:

Enregistrer un commentaire