?
Solved

How can I read files on an iSeries IFS from Visual Basic .NET 2010?

Posted on 2011-10-26
5
Medium Priority
?
1,330 Views
Last Modified: 2012-05-12
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.
0
Comment
Question by:Paul-Bailey
  • 3
  • 2
5 Comments
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 37030393
0
 

Author Comment

by:Paul-Bailey
ID: 37031047
Both of those examples are not applicable. The first is never resolved, where one guy says over and over to use the GetFiles() method, but never discusses how, or (I suspect) has ever tried it himself. It will not work as the cwbx.dll library is for connecting to the iSeries, not for reading the IFS.

The second also uses cwbx.dll, but it uses it to call programs written and running on the iSeries.

I just need a way of passing iSeries credentials to the Directory.GetFiles() method so that I can list/work with the files. I just can't understand why it isn't working... it should be really easy.
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 37032908
As you have discovered that getfiles does not take credentials and impersonation wont work in this scenario, you have to look at alternatives. The first link shows an example of using credentials to download a file from iSeries.
0
 

Accepted Solution

by:
Paul-Bailey earned 0 total points
ID: 37043784
The first example allows downloading from the IFS. That is clear and works. However, I can not find out what files exist in that location to download. (If I don't know the filename, how can I download it?)

I should have mentioned this in the OP: Using mapped drives (or Process.Start with the "net use" command) I can use the GetFiles() method with no problems when running as a normal VB program, but if I convert that program to a "LocalSystem" windows service (start a timer in OnStart(...) that calls the rest of the program) or a scheduled job I get the error I mention in the OP.

The program is running as a scheduled job under windows 2000 with no problems. The same program will not run under Windows 2008 as a scheduled job because of the error in the OP.

Can anyone help?
0
 

Author Closing Comment

by:Paul-Bailey
ID: 37196976
After a brief response the question was not followed through. Very disappointing. Closing now due to warnings from EE automails.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to use a free utility called 'Parkdale' to easily test the performance and benchmark any Hard Drive(s) installed in your computer. We also look at RAM Disks and their speed comparisons.
This article provides a convenient collection of links to Microsoft provided Security Patches for operating systems that have reached their End of Life support cycle. Included operating systems covered by this article are Windows XP,  Windows Server…
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question