if (ext == ".pdf") { Response.ContentType = "application/pdf"; } else if (ext == ".doc" || ext == ".rtf" || ext == ".docx") { Response.ContentType = "Application/msword"; } else if (ext == ".txt") { Response.ContentType = "text/Plain"; } else if (ext == ".rar") { Response.ContentType = "Application/x-rar-compressed"; } else if (ext == ".jpeg" || ext==".jpg") { Response.ContentType = "image/jpeg"; } else { Response.ContentType = "Application/octetstream"; } Response.AddHeader("Content-disposition", "attachment; filename=" + filename); Response.BinaryWrite(byteimg); Response.Flush(); Response.End(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)