Post a reply

Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)


Topic review


Re: Is it possible to store an resuse a FTP session?

Session.Open throws InvalidOperationException only if you called Session.Dispose before:

If you want to reuse the session, do not close it! Note that Session.Dispose is called implicitly at the end of the using block.

Is it possible to store an resuse a FTP session?


We have been using WinSCP in our project for a few years now. What we used to do was, create a session and dispose it every time we had to connect to one of our ftps. But, now that we are expanding massively we want to stop accessing our FTP server every few seconds.

Instead, we'd like to manage several several sessions for each ftp we are accessing, and re-use the same session without closing/disposing it until it timeouts.

I've tried to implement this but, every time i open a session and try to access it again without closing it, the Opened variable throws an InvalidOperationException error.

Is it possible to do this? Or is there any workarounds to solve this?