?
Solved

c#, VS2012 -- use code to move a file on Windows machine to AS400

Posted on 2013-12-20
1
Medium Priority
?
389 Views
Last Modified: 2014-01-03
I have an executable that is being scheduled to run via Windows Task Manager and must write a flat file from a Windows machine to an AS400 programatically.  The AS400 needs log in information.

So, in other words, when I do something like:

                    sw = new StreamWriter(this._APDeliveryPath + "APDIST" + sDate + ".txt");

this._APDeliveryPath is expressed something like \\as400server\folde\folder\folder ...

I don't have access to the AS400 without logging into it.

Can this be done programatically?
0
Comment
Question by:g_johnson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 21

Accepted Solution

by:
Craig Wagner earned 2000 total points
ID: 39754757
Yes it can be done programmatically. What you will need to do is impersonate a different user while executing the code that does the copy. You can find examples and sample code at the following links.

http://www.codeproject.com/Articles/10090/A-small-C-Class-for-impersonating-a-User

http://www.codeproject.com/Articles/4051/Windows-Impersonation-using-C

http://stackoverflow.com/questions/1168571/run-code-as-a-different-user-c
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses
Course of the Month14 days, 4 hours left to enroll

800 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