Retornar o download do arquivo de byte []

Este código

string xml = XmlHelper.ToXml(queryTemplate);

byte[] xmlb = StringHelper.GetBytes(xml);

var cd = new System.Net.Mime.ContentDisposition
{
    // for example foo.bak
    FileName = String.Format("{0}_v{1}.xml", queryModel.Name, queryModel.Version),

    // always prompt the user for downloading, set to true if you want
    // the browser to try to show the file inline
    Inline = false,
};
Response.AppendHeader("Content-Disposition", cd.ToString());
return File(xmlb, "application/xml");

Acontece que a codificação da string está incorreta depois de ser convertidabyte[]

Então eu preciso colocar ostring imediatamente em arquivo, como este

FileStream xfile = new FileStream(Path.Combine(dldir, filename), FileMode.Create, System.IO.FileAccess.Write);
hssfwb.Write(xfile);

Mas eu não quero fazer isso, não preciso do arquivo após o download. Eu só preciso devolvê-lo ao navegador como download de arquivo e não quero ter que lidar com a exclusão de arquivos depois que pode se tornar bastante agitado quando há um monte de solicitação.

Como corrigir a codificação de caracteres destring parabyte[] e devolvê-lo corretamente ao navegador?

oGetBytes função se parece com isso

public static byte[] GetBytes(string str)
{
    byte[] bytes = new byte[str.Length * sizeof(char)];
    System.Buffer.BlockCopy(str.ToCharArray(), 0, bytes, 0, bytes.Length);
    return bytes;
}

questionAnswers(3)

yourAnswerToTheQuestion