This code
string xml = XmlHelper.ToXml(queryTemplate); byte[] xmlb = StringHelper.GetBytes(xml); var cd = new System.Net.Mime.ContentDisposition { // for e
Something like this would work:
try { Response.ContentType = "application/octet-stream"; Response.AddHeader( "Content-Disposition", "attachment; filename=" + filename ); Response.OutputStream.Write(xmlb, 0, xmlb.Length); Response.Flush(); } catch(Exception ex) { // An error occurred.. }