|
-
Aug 27th, 2004, 01:30 PM
#1
Thread Starter
Lively Member
download text file to client using ASP.NET
Hi All,
I am trying to download a text file around 2KB from the server onto the client using ASP.NET
The downloaded file is incomplete 500bytes only
The code is as below:
Response.ContentType = "text/plain"; // Set the file content type to text
Response.Clear();
Response.Buffer = true;
Response.Charset = ""; // Remove the charset from the Content-Type header.
this.EnableViewState = false; //Turn off the view state.
Response.AppendHeader( "Content-Disposition","attachment; filename=FileName.txt" );
Response.AppendHeader( "Content-Length", strFileName.Length.ToString() );
Response.WriteFile( "Filename.txt" ); // Write the contents of file to client
Response.Flush();
Response.End()
Can anyone tell me what is going wrong.
Any help is appreciated.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|