I'm using PASTEBIN api to paste soem C# code. All works fine except that when my code contains an '&', this sounds strange to me since I'm using Uri.EscapeUriString
. Here the code that creates my payload:
private byte[] GetUploadData(string key, string s, string lang)
{
var payload = string.Join("&", new string[]
{
"api_option=paste"
,"api_dev_key=1234567890000000000000000000"
,"api_user_key="+login
,"api_paste_code="+Uri.EscapeUriString(s)
,"api_paste_expire_date=N"
,"api_paste_format="+lang
,"api_paste_name="+Uri.EscapeUriString(key)
,"api_paste_private = 0"
}
);
return System.Text.Encoding.UTF8.GetBytes(payload);
}
when code contains a '&' it get truncated. What can be wrong ?
Use Uri.EscapeDataString instead