This base64 in Requestheader.
base64=hysgng22yx0aijnqvnjw0xhebi32nh%2birvkdkbomuikpxw0% 2fs6rugflmsa527y8zz3gmezfxmb8ry8fh5gjgejfgqfxdc4a2hllvifzyideucqlogdajoola8jnif1c8nwrte0gncrm5rxkshlkzp2itzclgdcyz6ogaf7o Lnluob44cz3agf1q8hvgme8leqgoqxsiztt3xn%2b96j7zp%2fwa%3d
He turned the base64 into something like%2f.
So the webservice received the parameter is wrong.
Workaround:
stringBase64 ="base64=hysgng22yx0aijnqvnjw0xhebi32nh+irvkdkbomuikpxw0/ S6rugflmsa527y8zz3gmezfxmb8ry8fh5gjgejfgqfxdc4a2hllvifzyideucqlogdajoola8jnif1c8nwrte0gncrm5rxkshlkzp2itzclgdcyz6ogaf7oln Luob44cz3agf1q8hvgme8leqgoqxsiztt3xn+96j7zp/wa=";byte[] buffer =convert.frombase64string (base64);stringBase64strdata = convert.tobase64string (buffer). Replace ("+","%2b");//Note that the plus (' + ') substitution is handled, otherwise the BASE64 string is not valid because the plus sign passes through the URL and becomes a space stringPostData ="str="+Base64strdata; byte[] DataArray = Encoding.Default.GetBytes (postdata);
/// <summary> ///POST request and get results/// </summary> Public Static stringHttpPost (stringUrlstringpostdatastr) { Try{postdatastr= Postdatastr.replace ("+","%2b"); HttpWebRequest Request=(HttpWebRequest) webrequest.create (URL); Request. Method="POST"; Request. Timeout=6000000; Request. ContentType="application/x-www-form-urlencoded"; Request. ContentLength=postdatastr.length; StreamWriter writer=NewStreamWriter (Request. GetRequestStream (), encoding.ascii); Writer. Write (POSTDATASTR); Writer. Flush (); HttpWebResponse Response=(HttpWebResponse) request. GetResponse (); stringencoding =Response. ContentEncoding; if(Encoding = =NULL|| Encoding. Length <1) {Encoding="UTF-8";//default Encoding} StreamReader Reader=NewStreamReader (response. GetResponseStream (), encoding.getencoding (Encoding)); stringRetString =Reader. ReadToEnd (); returnretstring; } Catch(Exception ex) {return NULL; } }
C # Post data Base64 to interface error issues