How can I read files on an iSeries IFS from Visual Basic .NET 2010?
Posted on 2011-10-26
I have a folder in the IFS on an iSeries that contains files I want to process from within a Windows Service. The service has the LocalSystem authority (for now) to work with network resources, but when working with iSeries network resources (via a UNC) it needs to authenticate with an iSeries user profile/password pair.
I am using the Directory.GetFiles(...) method to work through all the files in the IFS folder, so how do I authenticate as the iSeries user from within Visual Basic .NET 2010?
I have tried the LogonUser/Impersonate route that you can find all over the internet, but it appears that it only works if the credentials you give the LogonUser are a valid login for the local PC, which the iSeries credentials will not be. I have also tried to use System.Diagnostics.Process.Start(processInfo) to run a NET USE command (which works well on the command line) but I get "Access to the path '\\bhsfiseries\letters\tstextrs\' is denied. (Err# 5)" when the service is trying to view the files.