For .Net Developer This Might Help You For Creating
download link to a file on a file server
string strURL;
strURL = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "AllFiles\Log\") + "SaleLogFile.log";//name of the file you are picking
WebClient req = new WebClient();
HttpResponse response = HttpContext.Current.Response;
response.Clear();
response.ClearContent();
response.ClearHeaders();
response.Buffer = true;
response.AddHeader("Content-Disposition", "attachment;filename='SaleLogFile.log'");//change downloaded file name
byte[] data = req.DownloadData(strURL);
response.BinaryWrite(data);
response.End();
download link to a file on a file server
string strURL;
strURL = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "AllFiles\Log\") + "SaleLogFile.log";//name of the file you are picking
WebClient req = new WebClient();
HttpResponse response = HttpContext.Current.Response;
response.Clear();
response.ClearContent();
response.ClearHeaders();
response.Buffer = true;
response.AddHeader("Content-Disposition", "attachment;filename='SaleLogFile.log'");//change downloaded file name
byte[] data = req.DownloadData(strURL);
response.BinaryWrite(data);
response.End();
No comments:
Post a Comment