Example #1
0
        private void OnChangeDirectory(object sender, FtpChangeDirectoryArgs e)
        {
            VirtualFtpServer  server  = (VirtualFtpServer)sender;
            VirtualFtpSession session = (VirtualFtpSession)e.Session;

            if (e.NewDirectory.Equals("/"))
            {
                session.CurrentFolder = server.RootFolder.GetSubFolder(session.Username, session);
                session.Directory     = String.Format(@"/{0}/", session.Username);
            }
        }
		protected override void InvokeOnChangeDirectory(FtpChangeDirectoryArgs e)
		{
			String lPath = e.NewDirectory;

			if (lPath.IndexOf('/') != 0)
				throw new Exception(String.Format("Not an absolute path: \"{0}\"", lPath));

			VirtualFtpSession lSession = (VirtualFtpSession)e.Session;
			IFtpFolder lFolder = RootFolder.DigForSubFolder(lPath.Substring(1), lSession);

			if (lFolder != null)
				((VirtualFtpSession)e.Session).CurrentFolder = lFolder;

			e.ChangeDirOk = (lFolder != null);
			base.InvokeOnChangeDirectory(e);
		}
Example #3
0
        protected override void InvokeOnChangeDirectory(FtpChangeDirectoryArgs e)
        {
            String lPath = e.NewDirectory;

            if (lPath.IndexOf('/') != 0)
            {
                throw new Exception(String.Format("Not an absolute path: \"{0}\"", lPath));
            }

            VirtualFtpSession lSession = (VirtualFtpSession)e.Session;
            IFtpFolder        lFolder  = RootFolder.DigForSubFolder(lPath.Substring(1), lSession);

            if (lFolder != null)
            {
                ((VirtualFtpSession)e.Session).CurrentFolder = lFolder;
            }

            e.ChangeDirOk = (lFolder != null);
            base.InvokeOnChangeDirectory(e);
        }