TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Mick
NA
3
0
Downloading files from a server (.NET, ASP, C#)
Aug 30 2005 11:55 AM
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
Reply
Answers (
3
)
Is there a document which introduce all table in the database aspnetdb.mdb?
Active Directory and .NET : paging the search result