I got some exception with following code(file downloading) but it's working fine..
string filename= Server.Map Path("~/Download/");
Response.ContentType = ContentType;
Response.AppendHeader("Content-Disposition", "attachment; filename=" + Path.GetFileName(filename));
Response.WriteFile(filename);
Response.End();
Exception is
Unable to evaluate the expression because the code is optimized or a native frame is on top of the call stack,,
So in the above code if I use HttpContext.Current.ApplicationInstance.CompleteRequest();
instead of Response.end();
the page source is appending to the file and it runs without any exception. Can anyone please clarify this? what is the cause..