S
Stefan Soljemo
I developing an asp.net application with a page that creating a file.
Redirect to another page with file information and shows a save as dialog.
The file will be streamed as contets type "application/force-download". The
first questeion is if I need to create the page twise. One with the HTML data
to be shown and a second with the sream. If so how to do the postback?
The second question is if its possible to att the contents type
"application/force-download" at the end of the page.
Note that the application using AJAX.
I use the folliwing code to create the stream:
stream = new FileStream( sFile, FileMode.Open, FileAccess.Read,
FileShare.Read );
Response.Clear();
Response.AddHeader( "Content-Disposition", "attachment; filename=" + sFile);
Response.AddHeader( "Content-Length", stream.Length.ToString() );
Response.ContentType = "application/force-download";
iBufSize = 16384;
buffer = new byte[ iBufSize ];
iCount = stream.Read( buffer, 0, iBufSize );
while( iCount > 0 )
{
Response.OutputStream.Write( buffer, 0, iCount );
iCount = stream.Read( buffer, 0, iBufSize );
}
Response.Flush();
Response.Close();
stream.Close();
Redirect to another page with file information and shows a save as dialog.
The file will be streamed as contets type "application/force-download". The
first questeion is if I need to create the page twise. One with the HTML data
to be shown and a second with the sream. If so how to do the postback?
The second question is if its possible to att the contents type
"application/force-download" at the end of the page.
Note that the application using AJAX.
I use the folliwing code to create the stream:
stream = new FileStream( sFile, FileMode.Open, FileAccess.Read,
FileShare.Read );
Response.Clear();
Response.AddHeader( "Content-Disposition", "attachment; filename=" + sFile);
Response.AddHeader( "Content-Length", stream.Length.ToString() );
Response.ContentType = "application/force-download";
iBufSize = 16384;
buffer = new byte[ iBufSize ];
iCount = stream.Read( buffer, 0, iBufSize );
while( iCount > 0 )
{
Response.OutputStream.Write( buffer, 0, iCount );
iCount = stream.Read( buffer, 0, iBufSize );
}
Response.Flush();
Response.Close();
stream.Close();