[Csharp] string FullFileName = "";
Try
{
String FileName = "trunpeng cloud mail interface document v2.0.pdf ";
FullFileName = Server. MapPath (FileName );
// FileName -- name of the file to be downloaded
FileInfo DownloadFile = new FileInfo (FullFileName );
If (DownloadFile. Exists)
{
Response. Clear ();
Response. ClearHeaders ();
Response. Buffer = false;
Response. ContentType = "application/octet-stream ";
Response. AppendHeader ("Content-Disposition", "attachment; filename =" + HttpUtility. UrlEncode (DownloadFile. FullName, System. Text. Encoding. ASCII ));
Response. AppendHeader ("Content-Length", DownloadFile. Length. ToString ());
Response. WriteFile (DownloadFile. FullName );
Response. Flush ();
Response. End ();
}
Else
{
// The file does not exist.
}
}
Catch (Exception ex)
{
// An exception occurred while enabling
}
String FullFileName = "";
Try
{
String FileName = "trunpeng cloud mail interface document v2.0.pdf ";
FullFileName = Server. MapPath (FileName );
// FileName -- name of the file to be downloaded
FileInfo DownloadFile = new FileInfo (FullFileName );
If (DownloadFile. Exists)
{
Response. Clear ();
Response. ClearHeaders ();
Response. Buffer = false;
Response. ContentType = "application/octet-stream ";
Response. AppendHeader ("Content-Disposition", "attachment; filename =" + HttpUtility. UrlEncode (DownloadFile. FullName, System. Text. Encoding. ASCII ));
Response. AppendHeader ("Content-Length", DownloadFile. Length. ToString ());
Response. WriteFile (DownloadFile. FullName );
Response. Flush ();
Response. End ();
}
Else
{
// The file does not exist.
}
}
Catch (Exception ex)
{
// An exception occurred while enabling
}