Tech
Forums
Jobs
Books
Events
Videos
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
3
Answers
Downloading files from a server (.NET, ASP, C#)
Mick
19y
2k
1
Reply
I am trying to download a file from a Windows 2000 server using the following code:
string
fileName = System.IO.Path.GetFileName(strFilePath);
Response.ClearHeaders();
Response.ClearContent();
Response.Clear();
Response.ContentType = "text/HTML";
Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName);
// Make sure the client is still connected.
if
(Response.IsClientConnected)
{
Response.TransmitFile(strFilePath);
Response.Flush();
}
However, along with the file data, the HTML from the ASP page is also downloaded!
I have also tried code using
"
Response.Output.Write(bBuffer, 0, nBytesRead);"
If anyone has an idea about why the HTML is being appended, and how to stop it, I would be grateful!
Thanks
Mick
Post
Reset
Cancel
Answers (
3
)
Next Recommended Forum
Is there a document which introduce all table in the database aspnetdb.mdb?
Active Directory and .NET : paging the search result