protected void Page_Load(object sender, EventArgs e)
    {
                  string filepath = Server.MapPath("~/UpLoadFile/" + caseNo + "/" + filename);
                    FileStream fs = new FileStream(filepath, FileMode.Open, FileAccess.Read);                    byte[] bytes = new byte[(int)fs.Length];
                    fs.Read(bytes, 0, bytes.Length);
                    fs.Close();
                    Response.ContentType = GetContentType(filename);
                    Response.Charset = "utf-8";
                    Response.ContentEncoding = Encoding.GetEncoding("utf-8");
                    Response.OutputStream.Write(bytes, 0, bytes.Length);
                    Response.End();
}
 private string GetContentType(string fileName)
    {
        string _contentType = string.Empty;
        if (fileName.EndsWith("doc"))
        {
            _contentType = "application/msword";
        }
        if (fileName.EndsWith("docx"))
        {
            _contentType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
        }
        if (fileName.EndsWith("xls"))
        {
            _contentType = "application/vnd.ms-excel";
        }
        if (fileName.EndsWith("xlsx"))
        {
            _contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
        }
        if (fileName.EndsWith("jpg") || fileName.EndsWith("jpe") || fileName.EndsWith("jpeg"))
        {
            _contentType = "image/jpeg";
        }
        if (fileName.EndsWith("png"))
        {
            _contentType = "image/png";
        }
        if (fileName.EndsWith("gif"))
        {
            _contentType = "image/gif";
        }
        if (fileName.EndsWith("bmp"))
        {
            _contentType = "image/bmp";
        }
        if (fileName.EndsWith("pdf"))
        {
            _contentType = "application/PDF";
        }
        if (fileName.EndsWith("ppt"))
        {
            _contentType = "application/vnd.ms-powerpoint";
        }
        return _contentType;
    }