private void WriteFile(byte[] content, string fileName, string contentType, HttpResponse response) { response.Buffer = true; response.Clear(); response.ContentType = contentType; string extension = System.IO.Path.GetExtension(fileName); if (extension != ".htm" && extension != ".html" && extension != ".xml") { response.AddHeader("content-disposition", "attachment; filename=" + fileName); } response.BinaryWrite(content); response.Flush(); response.End(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)