The initial request did not convert byt
to string - it just used it as bytes. So this line:
Response.Redirect("Page2.aspx?BytArray=" + byt,false);
Actually there was this URL:
Page2.aspx?BytArray=System.Byte[]
You need to change this line to:
Response.Redirect("Page2.aspx?BytArray=" + HttpUtility.UrlEncode(System.Convert.ToBase64String(byt)), false);
And then on the way back, replace all of this:
var byteArray = System.Text.Encoding.UTF8.GetBytes(Request.QueryString["BytArray"]); var x1 = System.Convert.ToBase64String(byteArray, 0, byteArray.Length); var x2 = Encoding.UTF8.GetString(byteArray);
Only with this:
var byteArray = Convert.FromBase64String(Request.QueryString["BytArray"]); var x2 = Encoding.UTF8.GetString(byteArray);
source share