Post a reply

Options
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)

Options

Topic review

martin

Re: HomePath = 'session.HomePath' threw an exception of type 'System.InvalidOperationException'

vijay65432 wrote:

when i execute task in the SSIS Package getting script error :

Task Name:  Package:Pkg.Import.FTPFiles.dtsx; Method:Main
Error Description:  Error when using WinSCP to upload files: System.InvalidOperationException: Session is not opened at WinSCP.Session.CheckOpened() at WinSCP.Session.FileExists(String path) at ST_2f147f67ddac483387950b7bb5418974.ScriptMain.Main() in c:\Users\503738394\AppData\Local\Temp\4\vsta\90b12eb0e2c349f48cfeecde5050ccfb\ScriptMain.cs:line 223
How to check the homepath and change the homepath will it resolve this issues please help....

The callstack shows that you get the exception by calling Session.FileExists. So why do you think that this has anything to do with Session.HomePath? Consider starting a new thread and provide more details, including a code sample and a log file. Though the problems seems to be that you call Session.FileExists before Session.Open.
vijay65432

HomePath = 'session.HomePath' threw an exception of type 'System.InvalidOperationException'

when i execute task in the SSIS Package getting script error :

Task Name:  Package:Pkg.Import.FTPFiles.dtsx; Method:Main
Error Description:  Error when using WinSCP to upload files: System.InvalidOperationException: Session is not opened at WinSCP.Session.CheckOpened() at WinSCP.Session.FileExists(String path) at ST_2f147f67ddac483387950b7bb5418974.ScriptMain.Main() in c:\Users\503738394\AppData\Local\Temp\4\vsta\90b12eb0e2c349f48cfeecde5050ccfb\ScriptMain.cs:line 223
How to check the homepath and change the homepath will it resolve this issues please help....
martin

martinc wrote:

My question is how do set the home path for the account?

I want to work in a subfolder from the home folder.

The home path for an account needs to be set of the server.
But you do not need to change a home path to work with files in another folder.
Just use an absolute path to the other folder in all calls to WinSCP .NET assembly methods.
The assembly does not have a concept of a working directory, if that's what your question is actually about.
martinc

My question is how do set the home path for the account?

I want to work in a subfolder from the home folder.
martin

I was asking what directory would your consider correct as a home path (for your account). What is not the same as the directory you want to connect to.

So now I'm not sure what is actually your question.

Do you believe that /clientdata/CL/TST_CL is not the home directory of your account? (but your SFTP server tell otherwise) Or do you actually want to "work" in another folder than your home folder?
martinc

Thank you for reply. I have attached the session log.

The log says that the Real path is '/clientdata/CL/TST_CL' but I want to connect to 'home/TST_CL'. The home directory is located in the root.
martin

Re: Session HomePath

Answer to your question greatly depends on a protocol that you are using. The best would be, if you post a session log file (Session.SessionLogPath). And tell us what path do you get in HomePath and what path would you consider correct.
martinc

Session HomePath

When I open a new session using session.Open() I can see that the value of the HomePath has been set to a particular directory that is incorrect. I am wondering where this HomePath is set and how can I change it?

Thank you for any help