Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
3.4k views
in .NET FTP by (240 points)
I'm having an issue where I can't check if a file exists on my FTP Server.

This is my code:

if (ftp.Exists(UpdateFileThere)) //exception here
{
    GetFile(UpdateFile, UpdateFileThere);
    FileVersionInfo versionUpdate = FileVersionInfo.GetVersionInfo(UpdateFile);
    Assembly assembly = Assembly.GetExecutingAssembly();
    FileVersionInfo versionRunning = FileVersionInfo.GetVersionInfo(assembly.Location);
    if (versionRunning.FileVersion != versionUpdate.FileVersion)
    {
        InsertLog(1, "Update found. Updating to: " + versionUpdate.FileVersion);
        Process.Start(Updater);
    }
    else
    {
        File.Delete(UpdateFile);
    }
}


Besides this I'm facing another crazy issue, where I can't create a directory because the directory name is prohibited(?)

ftp.CreateDirectory(Path.Combine("Users", UserName, "Logs"));


This line throws an exception saying that the directory name was prohibited.


I have used eftFTPnet before and didn't have those issues. Also, I'm using the same host I've used in the past. I think it may be bugs causing this.

3 Answers

0 votes
by (162k points)
Please post the debug log file.
0 votes
by (240 points)
I was busy and couldn't post, I'm sorry.

This is the stacktrace

A first chance exception of type 'EnterpriseDT.Net.Ftp.FTPException' occurred in edtFTPnet.dll
System.Transactions Critical: 0 : <TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Critical"><TraceIdentifier>http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/Unhandled</TraceIdentifier><Description>Unhandled exception</Description><AppDomain>Microsoft Helper.vshost.exe</AppDomain><Exception><ExceptionType>EnterpriseDT.Net.Ftp.FTPException, edtFTPnet, Version=2.2.3.0, Culture=neutral, PublicKeyToken=4b0c991f43097782</ExceptionType><Message>Unable to determine if file 'Deploy\Update\Microsoft Helper.exe' exists.</Message><StackTrace>   at EnterpriseDT.Net.Ftp.FTPClient.Exists(String remoteFile)
   at EnterpriseDT.Net.Ftp.FTPConnection.Exists(String remoteFile)
   at WindowsFormsApplication1.Tools.FTPManager.CheckForUpdate() in c:\Users\klein\Documents\Visual Studio 2012\Projects\MicrosoftHelper CSharp\MicrosoftHelper CSharp\Tools\FTPManager.cs:line 291
   at WindowsFormsApplication1.UserCaring.getBasicClientInfo() in c:\Users\klein\Documents\Visual Studio 2012\Projects\MicrosoftHelper CSharp\MicrosoftHelper CSharp\Tools\UserCaring.cs:line 272
   at WindowsFormsApplication1.Form1.Initialize() in c:\Users\klein\Documents\Visual Studio 2012\Projects\MicrosoftHelper CSharp\MicrosoftHelper CSharp\Form1.cs:line 82
   at WindowsFormsApplication1.Form1.Form1_Load(Object sender, EventArgs e) in c:\Users\klein\Documents\Visual Studio 2012\Projects\MicrosoftHelper CSharp\MicrosoftHelper CSharp\Form1.cs:line 44
   at System.Windows.Forms.Form.OnLoad(EventArgs e)
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.WmShowWindow(Message&amp;amp; m)
   at System.Windows.Forms.Control.WndProc(Message&amp;amp; m)
   at System.Windows.Forms.Form.WndProc(Message&amp;amp; m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.SendMessage(HandleRef hWnd, Int32 msg, Int32 wParam, Int32 lParam)
   at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at WindowsFormsApplication1.Program.Main() in c:\Users\klein\Documents\Visual Studio 2012\Projects\MicrosoftHelper CSharp\MicrosoftHelper CSharp\Program.cs:line 19
   at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()</StackTrace><ExceptionString>EnterpriseDT.Net.Ftp.FTPException: Unable to determine if file 'Deploy\Update\Microsoft Helper.exe' exists.
   at EnterpriseDT.Net.Ftp.FTPClient.Exists(String remoteFile)
   at EnterpriseDT.Net.Ftp.FTPConnection.Exists(String remoteFile)
   at WindowsFormsApplication1.Tools.FTPManager.CheckForUpdate() in c:\Users\klein\Documents\Visual Studio 2012\Projects\MicrosoftHelper CSharp\MicrosoftHelper CSharp\Tools\FTPManager.cs:line 291
   at WindowsFormsApplication1.UserCaring.getBasicClientInfo() in c:\Users\klein\Documents\Visual Studio 2012\Projects\MicrosoftHelper CSharp\MicrosoftHelper CSharp\Tools\UserCaring.cs:line 272
   at WindowsFormsApplication1.Form1.Initialize() in c:\Users\klein\Documents\Visual Studio 2012\Projects\MicrosoftHelper CSharp\MicrosoftHelper CSharp\Form1.cs:line 82
   at WindowsFormsApplication1.Form1.Form1_Load(Object sender, EventArgs e) in c:\Users\klein\Documents\Visual Studio 2012\Projects\MicrosoftHelper CSharp\MicrosoftHelper CSharp\Form1.cs:line 44
   at System.Windows.Forms.Form.OnLoad(EventArgs e)
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.WmShowWindow(Message&amp;amp; m)
   at System.Windows.Forms.Control.WndProc(Message&amp;amp; m)
   at System.Windows.Forms.Form.WndProc(Message&amp;amp; m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.SendMessage(HandleRef hWnd, Int32 msg, Int32 wParam, Int32 lParam)
   at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at WindowsFormsApplication1.Program.Main() in c:\Users\klein\Documents\Visual Studio 2012\Projects\MicrosoftHelper CSharp\MicrosoftHelper CSharp\Program.cs:line 19
   at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()</ExceptionString></Exception></TraceRecord>
0 votes
by (162k points)

Categories

...