Hi, I'm trying to get the editor's save button to download a rft file on click. I have it basically working except for the fact that the saved file does not open properly. What can I do to make this happen?
Here's a code snippet:
private void Editor1_PostBackCommand(object sender, System.Web.UI.WebControls.CommandEventArgs e)
{
if(string.Compare(e.CommandName,"Save",true)==0)
{
byte[] output = ConvertStringToByteArray(Editor1.Text);
Response.AddHeader("Content-Disposition", "attachment; filename=cute.rtf");
Response.ContentType = "application/rtf";
Response.Clear();
Response.Buffer = true;
Response.BinaryWrite(output);
Response.End();
}
}
public static byte[] ConvertStringToByteArray(string stringToConvert)
{
return (new UnicodeEncoding()).GetBytes(stringToConvert);
}
It looks garbled in wordpad and will not open in MS word. However in notepad it just shows the plain html output string. Any ideas? Thanks!