private void DownloadFileMSI()
{
string fname = Server.MapPath("PNRExtractor") + "\\PNRExtractor.msi";
Response.ContentType = "application/exe";
Response.AddHeader("content-disposition", "attachment; filename=PNRExtractor.msi");
//System.IO.FileStream sourceFile = new System.IO.FileStream(@"" + fname, System.IO.FileMode.OpenOrCreate);
System.IO.FileStream sourceFile = new System.IO.FileStream(@"" + fname, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.None);
long FileSize;
FileSize = sourceFile.Length;
byte[] getContent = new byte[(int)FileSize];
sourceFile.Read(getContent, 0, (int)sourceFile.Length);
sourceFile.Close();
Response.BinaryWrite(getContent);
}
Friday, June 18, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment