sending file to client side
-
Hi, I need to send a file created at the server to client side. I could redirect the url to point to the excel file im generating and rely on IE to open. But I want the open/save dialog to popup. Is there any way I can stream the file? thanks Rak
The REFERENCE article below is not exactly what you're asking for, but if you look at it carefully, it gives you what it takes to send a file to client side: By playing with Http headers: Response.AppendHeader("Content-Disposition","attachment; filename=" + fileName); Response.ContentType = contentType; Response.OutputStream.Write(fileData, 0, fileData.Length); //fileData is held in memory --> you need to load the memory with your Excel file instead. REFERENCE: http://stardeveloper.com/articles/display.html?article=2003031201&page=11 One caveat: It's important to specify "content length". You will find corrupted files otherwise (An important piece of information not found in the article). But, here it is: Response.AppendHeader("Content-Length", filesize.ToString()); norm
-
The REFERENCE article below is not exactly what you're asking for, but if you look at it carefully, it gives you what it takes to send a file to client side: By playing with Http headers: Response.AppendHeader("Content-Disposition","attachment; filename=" + fileName); Response.ContentType = contentType; Response.OutputStream.Write(fileData, 0, fileData.Length); //fileData is held in memory --> you need to load the memory with your Excel file instead. REFERENCE: http://stardeveloper.com/articles/display.html?article=2003031201&page=11 One caveat: It's important to specify "content length". You will find corrupted files otherwise (An important piece of information not found in the article). But, here it is: Response.AppendHeader("Content-Length", filesize.ToString()); norm