Removing response.End() includes the html of the page.
- by vinay_rockin
HttpResponse response = Context.Http.Response;
response.Headers.Clear();
response.Clear();
response.ContentType = Component.OverrideMimeType ? Component.MimeType : "application/download";
response.AppendHeader("Content-Disposition",
String.Format("attachment; filename=\"{0}\"", HttpUtility.HtmlEncode(Path.GetFileName(file.FileName))));
response.OutputStream.Write(file.Contents, 0, file.Contents.Length);
response.Flush();
// response.End();
if I use response.End() it throws exception and if I comment response.End() it includes the html of the page on which the download link resides. how want to download file with introducing this exta html.
Any Idea how to fix this?