protected override void InvokeOnCanRetrieveFile(FtpTransferEventArgs e) { VirtualFtpSession lSession = (VirtualFtpSession)e.Session; IFtpFolder lFolder; String lFilename; lSession.CurrentFolder.FindBaseFolderForFilename(e.FileName, out lFolder, out lFilename, lSession); IFtpFile lFile = lFolder.GetFile(lFilename, lSession); e.Ok = (lFile != null && lFile.AllowRead(lSession)); }
public override IFtpFile GetFile(String fileName, VirtualFtpSession session) { if (!HasFile(fileName)) { throw new FtpException(String.Format("A file named \"{0}\" does not exists.", fileName)); } if (!AllowBrowse(session)) { throw new FtpException(550, String.Format("Cannot access file \"{0}\", permission to access files in this folder denied.", fileName)); } IFtpFile lFile = FileList[fileName.ToLower()] as IFtpFile; if ((lFile == null) || !lFile.AllowRead(session)) { throw new FtpException(550, String.Format("Cannot access file \"{0}\", permission to access file denied.", fileName)); } return(lFile); }