Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.

932 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now