How to Download file to root directory

Posted by Alok under ASP.NET on 4/8/2011 | Points: 10 | Views : 3615 | Status : [Member] | Replies : 3
i want to download file without asking SaveAs Option,I want that Downloaded file will automatically Saves to RootDirectory of Server e.x-downloads.
.I m trying to export gridview data to word and at the same time it should be saved to the "download" folder of my directory without Asking saveAs ...
If Anybody Have Idea..Then Rply Plz..
Thanks..
Alok Kumar

Thanks & Regards,
Alokssm



Responses

Posted by: Karthikanbarasan on: 4/11/2011 [Member] [Moderator] [Microsoft_MVP] [MVP] Silver | Points: 25

Up
0
Down
try this code


System.Net.WebClient webClient = new System.Net.WebClient();

string source = Server.MapPath("~/UploadFile/Temp1.txt");
string destination = @"C:/FileUpload\Temp1.txt";
webClient.DownloadFile(source, destination);
txtFilePath.Text = destination;
System.IO.Stream stream = null;


Thanks
Karthik
www.f5Debug.net

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

Posted by: Alok on: 4/11/2011 [Member] Starter | Points: 25

Up
0
Down
thanks...

Thanks & Regards,
Alokssm

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

Posted by: Karthikanbarasan on: 4/11/2011 [Member] [Moderator] [Microsoft_MVP] [MVP] Silver | Points: 25

Up
0
Down
HI,

Mark it as answer if it solves your issue...

Thanks
Karthik
www.f5Debug.net

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

Login to post response