Rar file download on button click when we are using the ScriptManager & updatepanel on webpage.

Jul 26 2011 3:09 AM
Hi All,

Please suggest me by some example code.

I am using the ScriptManager & updatepanel on webpage.My page has radiobuttonlist,when we select any radio button than download button appers. after the click on the button i getting the parser error:

Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.
Details: Error parsing near 'Rar!'.
please suggest me..............my code is:

HttpContext.Current.Response.ContentType = "application/x-rar-compressed";
         
            HttpContext.Current.Response.AddHeader("Content-Disposition", "inline; filename=" + System.IO.Path.GetFileName(filePath));


            HttpContext.Current.Response.Clear();
            HttpContext.Current.Response.WriteFile(filePath);
            HttpContext.Current.Response.End();

Than i called through this code:
 DownloadAssistant.WireUpDownloadButton(imgBtAndroid, "Download", Server.MapPath("~/downloadstuff/Android.rar"));


Please tell where  i did wrong?



Answers (2)