Saving a file without a save dialog using Response.Binarywrtite()

Posted by Sateeshkumar.Singupuram under C# on 8/30/2013 | Points: 10 | Views : 5281 | Status : [Member] | Replies : 1
Hi ,

i have a binary array to save in a specified location. all i want is to save that file in a predefined Path. (without a dialog box to the user to chose the location.)

Here is my Code.

filename = string.Format("{0}.{1}", "ExportToExcel", "xls");
Response.Buffer = true;
Response.Clear();
Response.ContentType = mimeType;
Response.AppendHeader("content-disposition","attachment; filename ="+ filename);
Response.BinaryWrite(bytes1); // create the file
Response.TransmitFile("E:\\Projects\\ExportToExcel.xls");
Response.Flush();
Response.End();

this above code is showing a save file dialog which is not suitable for my requirement. please provide me a quick solution.

Thanks & Regards,
Sateesh Kumar S

sateesh kumar singupuram


Responses

Posted by: Bandi on: 8/30/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
Refer this link once...
http://www.codeproject.com/Questions/224663/Saving-an-excel-file-without-prompt
http://www.west-wind.com/weblog/posts/2007/May/21/Downloading-a-File-with-a-Save-As-Dialog-in-ASPNET
http://stackoverflow.com/questions/8590543/force-browser-to-download-pdf-document-instead-of-opening-it
http://www.tek-tips.com/viewthread.cfm?qid=1563327

Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Sateeshkumar.Singupuram, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response