The download path is hidden by passing the ID in the database, and then reading the path in the database through the passed ID on the other page.
The implementation method in c # (only the. ASPX. CS code is required)
String sel_ SQL = "select FileVisualPath from TabMailAttachFiles where FileID =" Request. QueryString ["destFileName"]. ToString ();
// String destFileName = Request. QueryString ["destFileName"]! = Null? Request. QueryString ["destFileName"]: "";
String destFileName = ROA. Components. fune_performance.execad (sel_ SQL). Tables [0]. Rows [0] [0]. ToString ();
DestFileName = Server. MapPath (".") destFileName;
DestFileName = Server. UrlDecode (destFileName );
If (File. Exists (destFileName ))
{
FileInfo fi = new FileInfo (destFileName );
Response. Clear ();
Response. ClearHeaders ();
Response. Buffer = false;
// Response. AppendHeader ("Content-Disposition", "attachment; filename =" HttpUtility. UrlEncode (Path. GetFileName (destFileName), System. Text. Encoding. Default ));
Response. AppendHeader ("Content-Disposition", "attachment; filename =" HttpUtility. UrlEncode (Path. GetFileName (destFileName), System. Text. Encoding. UTF8 ));
Response. AppendHeader ("Content-Length", fi. Length. ToString ());
Response. ContentType = "application/octet-stream ";
Response. WriteFile (destFileName );
Response. Flush ();
Response. End ();
}
Else
{
Response. Write ("<script langauge = javascript> alert (the file does not exist !); History. go (-1); </script> ");
Response. End ();
}