Click here to Skip to main content
15,887,821 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Please help me i want know the status of downloading.

After successfully Downloading i need to display a message
Posted

1 solution

 
Share this answer
 
Comments
Balu Balaji 14-Sep-12 8:09am    
Thanks for your suggisation i tried the following code
http://odetocode.com/Blogs/scott/archive/2010/06/23/checking-client-download-success-with-asp-net-mvc.aspx

but i'm getting 3 errors like

one is
1. public CheckedFileStreamResult(FileStream stream, string contentType)
: base(stream, contentType)

Error: here Object Doesnot contain a constructor that takes '2' arguments.

2. using (FileStream)

Error: System.IO.Filestream is a 'type' but used like variable.

3. var count = FileStream.Read(buffer, 0, _bufferSize);

Error: an Object Reference is Required for Non Static field metho or propery system.Io.Read(byte[],int,int)

public class CheckedFileStreamResult : FileStreamResult
{
public CheckedFileStreamResult(FileStream stream, string contentType)
:base(stream, contentType)
{
DownloadCompleted = false;
}

what shoul i do.......

Code is

public bool DownloadCompleted { get; set; }

protected override void WriteFile(HttpResponseBase response)
{
var outputStream = response.OutputStream;
using (FileStream)
{
var buffer = new byte[_bufferSize];
var count = FileStream.Read(buffer, 0, _bufferSize);
while(count != 0 && response.IsClientConnected)
{
outputStream.Write(buffer, 0, count);
count = FileStream.Read(buffer, 0, _bufferSize);
}
DownloadCompleted = response.IsClientConnected;
}
}

private const int _bufferSize = 0x1000;
}




Thanks in advance

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900