There is a string after encryption

DaNiPoG

I try to send it to the server using the POST method, but a completely different line arrives at the server. Here is the line that comes to the server.

nGrJ51VWvB4foOyTrDnBegpyDpY9W / cKNYc3S0TFnuIZGGxOs4YRbbiONQeFKvxYIsxzVLZEtnHSzk8d21AHGcGYcSNFENCxVBy8i2IGDKEzvl5vQ1hcGzzwXMjyoTYsfjkP6DSqSc4PIo2T / S 9zEC3WYzRuyoXhMq / N62RxD4 =

When sending this string, a transfer is made to the byte [] array, which apparently "breaks" it.

byte[] sentData = Encoding.UTF8.GetBytes(Data); req.ContentLength = Data.Length; Stream sendStream = req.GetRequestStream(); sendStream.Write(sentData, 0, sentData.Length); sendStream.Close(); 

How to fix this problem?

  • And how do you get the data on the server? - VladD
  • Sending is done by the POST method, respectively, the data is stored in the POST array. - Lam
  • Uh, and the code can be? - VladD
  • WebRequest req = WebRequest.Create (Url); req.Method = "POST"; req.Timeout = 100000; req.ContentType = "application / x-www-form-urlencoded"; byte [] sentData = Encoding.UTF8.GetBytes (Data); req.ContentLength = Data.Length; Stream sendStream = req.GetRequestStream (); sendStream.Write (sentData, 0, sentData.Length); sendStream.Close (); - Lam
  • No, this is the sending code, and the receiving code? - VladD

1 answer 1

Found a solution to this problem, changed the sending request. Here is a sample code:

 using (var webClient = new WebClient()) { var pars = new NameValueCollection(); pars.Add("message", "CUgUPZxdVGSIT3FzzT9Pc5VfOwKnwZ5fUlSks7hQazk2wJCigOxE3vkuLnIqa8Ab4pLNzdeMsGrV2RgmG4YlMPTfqpOsdkLFwfeqiY/EVrIdbY389eD0oid40JHryosEdHppVkQkpmKYNxhw4VDhbGQ2oTyR0Tk4/KMY/WC63IE="); var response = webClient.UploadValues(url, pars); string str = System.Text.Encoding.UTF8.GetString(response); Console.WriteLine(str); Console.ReadKey(); } / EVrIdbY389eD0oid40JHryosEdHppVkQkpmKYNxhw4VDhbGQ2oTyR0Tk4 / KMY / WC63IE ="); using (var webClient = new WebClient()) { var pars = new NameValueCollection(); pars.Add("message", "CUgUPZxdVGSIT3FzzT9Pc5VfOwKnwZ5fUlSks7hQazk2wJCigOxE3vkuLnIqa8Ab4pLNzdeMsGrV2RgmG4YlMPTfqpOsdkLFwfeqiY/EVrIdbY389eD0oid40JHryosEdHppVkQkpmKYNxhw4VDhbGQ2oTyR0Tk4/KMY/WC63IE="); var response = webClient.UploadValues(url, pars); string str = System.Text.Encoding.UTF8.GetString(response); Console.WriteLine(str); Console.ReadKey(); } 

After sending in this way, comes the line that sent.