Aug 09, 2010, 4:23 AM
[CLOSED] Save Dialog v0.8.1
Hi, I am using the following code to open a save dialog from codebehind, but I am getting this error:
Request Failure
Bad Response: Invalid Character
Request Failure
Bad Response: Invalid Character
private bool responseEnd = false;
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
Button1.AjaxEvents.Click.Event += new Coolite.Ext.Web.ComponentAjaxEvent.AjaxEventHandler(Click_Event);
this.LoadComplete += new EventHandler(LoadCompleteHandler);
}
private void LoadCompleteHandler(object sender, EventArgs e)
{
if (responseEnd)
{
Response.End();
}
}
void Click_Event(object sender, Coolite.Ext.Web.AjaxEventArgs e)
{
//This doesn't work
//Response.ContentType = "image/jpeg";
//Response.AppendHeader("Content-Disposition", "attachment; filename=image1.jpeg");
//Response.TransmitFile(Server.MapPath("~/Images/image1.jpeg"));
//Response.End();
this.Context.Response.Clear();
this.Context.Response.AddHeader("Content-Disposition", string.Format("attachment; filename=person.jpg"));
this.Context.Response.ContentType = "application/octet-stream";
this.Context.Response.WriteFile(string.Format("C:/person.jpg"));
}
Any Ideas?
Last edited by Daniil; Aug 09, 2010 at 4:36 PM.