G
Guest
Why does the following code include the HTML page in the downloaded file
Response.ContentType="application/x-msdownload";
Response.AddHeader( "content-disposition","attachment; filename=download.txt");
FileStream sourceFile = new FileStream(@"c:\temp\scbdoif.txt", FileMode.Open);
long FileSize;
FileSize = sourceFile.Length;
byte[] getContent = new byte[(int)FileSize];
sourceFile.Read(getContent, 0, (int)sourceFile.Length);
sourceFile.Close();
Response.BinaryWrite(getContent);
When I download the file I will see ("<html>.....</html> at the end of the file.
Response.ContentType="application/x-msdownload";
Response.AddHeader( "content-disposition","attachment; filename=download.txt");
FileStream sourceFile = new FileStream(@"c:\temp\scbdoif.txt", FileMode.Open);
long FileSize;
FileSize = sourceFile.Length;
byte[] getContent = new byte[(int)FileSize];
sourceFile.Read(getContent, 0, (int)sourceFile.Length);
sourceFile.Close();
Response.BinaryWrite(getContent);
When I download the file I will see ("<html>.....</html> at the end of the file.