Solved

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

Posted on 2013-12-20
1
383 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 500 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

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

707 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