Solved

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

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

758 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

24 Experts available now in Live!

Get 1:1 Help Now