Hi,
I just tried this and should ideally work for you as well.
Step1:
Create a local user with the SAME credentials (login/password) that you use
you login to your server in DMZ.
AND make this user part of local Administrator group.
Step2:
Create the ConsoleApplication1.exe using the code below:
using System;
using System.IO;
using System.Diagnostics;
namespace ConsoleApplication1
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
string path = @"c:\temp\MyTest.txt";
string path2 = @"\\[Put Destination IP here]\c$\TEMP\MyTest.txt";//<-[Put
Destination IP here]
try
{
// Create the file and clean up handles.
using (FileStream fs = File.Create(path)) {}
// Ensure that the target does not exist.
File.Delete(path2);
// Copy the file.
File.Copy(path, path2);
Console.WriteLine("{0} copied to {1}", path, path2);
// Try copy the file, which should succeed.
File.Copy(path, path2, true);
EventLog.WriteEntry("FileCopyOverDMZ-Scheduled Task","Successfully
Copied!!!", EventLogEntryType.Warning);
}
catch (Exception e)
{
EventLog.WriteEntry("FileCopyOverDMZ-Scheduled Task",e.Message,
EventLogEntryType.Error);
}
}
}
}
Step3:
Now create a scheduled task and provide the credentials for the local user
that was created in Step1.
This enables the application to copy the files as it would impersonate the
administrator role of the server in DMZ.
Could you please give a try and let me know the outcome(from the Event
Logs)?
Hope this helps!
Thanks-
"Mantorok" <no**@none.comwrote in message
news:f5**********@newsfeed.th.ifl.net...
The network guys setup an ip-route on my PC so I can access the server
using a local ip address.
Then I have to provide a usename/password.
Kev
"Shine Xavier" <sh**********@gmail.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
>How do you access the server in the DMZ currently and transfer the files?
The reason why i am asking this is to understand the ports that are
opened in the firewall currently.
Thanks -
"Mantorok" <no**@none.comwrote in message
news:f5**********@newsfeed.th.ifl.net...
>>Thanks, but the server is on a different network, and the admin account
is local to that server.
Presumably that rules out a scheduled task running under the account? Or
am I wrong?
Kev
"Shine Xavier" <sh**********@gmail.comwrote in message
news:Ow**************@TK2MSFTNGP03.phx.gbl...
One good option would be to wrap the file copy operation into an exe
(which is very much possible) and use the "Schedule Task Wizard" to run
this as a daily task using the required user credentials.
Hope this helps!
Thanks -
"Mantorok" <no**@none.comwrote in message
news:f5**********@newsfeed.th.ifl.net...
Hi all
>
C# v2.0
>
I want to update a server which is in our DMZ, to access this server I
always need to enter the admin user id and password.
>
I want to copy some files overnight to this server using a C# app, is
this possible? Can I provide the credentials to enable me to access
the server?
>
Thanks
Kev
>