This code
string xml = XmlHelper.ToXml(queryTemplate); byte[] xmlb = StringHelper.GetBytes(xml); var cd = new System.Net.Mime.ContentDisposition { // for e
I have had the answer for this, it turns out the problem was character encoding.
The solution link is below
Converting string to byte[] creates zero character