protected void FileManager1_FileDownload (object sender, DownloadFileCancelEventArgs e) {
		if(ProhibitDownload.Checked)
		{
			e.Cancel = true;
			Label1.Text = "Downloading file " + HttpUtility.HtmlEncode (e.DownloadFile.PhysicalPath) + " is prohibited.";
		}
	}
Example #2
0
 private void controller_FileDownload(object sender, DownloadFileCancelEventArgs e)
 {
     if (FileDownload != null)
     {
         FileDownload(this, e);
     }
 }
 void RaisePostBackEvent(string eventArgument)
 {
     var args = eventArgument.Split(new[] { ':' });
     FileManagerItemInfo fmi = ResolveFileManagerItemInfo(DecodeURIComponent(args[1]));
     switch (args[0])
     {
         case "Download":
             var e = new DownloadFileCancelEventArgs() { DownloadFile = fmi };
             OFileDownload(e);
             if (!e.Cancel)
             {
                 string file = fmi.PhysicalPath;
                 if (File.Exists(file))
                 {
                     Page.Response.Clear();
                     Page.Response.ContentType = "application/octet-stream";
                     Page.Response.AddHeader("Content-Disposition",
                                             "attachment;filename=" + EncodeURIComponent(Path.GetFileName(file)));
                     Page.Response.TransmitFile(file);
                 }
                 Page.Response.End();
             }
             break;
         case "ExecuteCommand":
             OnExecuteCommand(fmi, args[2], args[3]);
             break;
     }
 }
 private void OFileDownload(DownloadFileCancelEventArgs e)
 {
     if (FileDownload != null)
         FileDownload(this, e);
 }
 private void controller_FileDownload(object sender, DownloadFileCancelEventArgs e)
 {
     if (FileDownload != null)
         FileDownload(this, e);
 }