473,320 Members | 2,080 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Copying files to file-server

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
Jun 25 '07 #1
9 11986
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

Jun 25 '07 #2
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


Jun 25 '07 #3
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



Jun 25 '07 #4
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



Jun 25 '07 #5
Hi,

"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.
Enter it where?
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?

You will ahve to execute the process as the admin user.

can you use FTP? it would be a better solution IMO
Jun 25 '07 #6

"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.
so basically you use a "regular" windows copy procedure, in this case you
have to impersonate teh admin.

Jun 25 '07 #7

"Ignacio Machin ( .NET/ C# MVP )" <machin TA laceupsolutions.comwrote in
message news:eV*************@TK2MSFTNGP04.phx.gbl...
Hi,

"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.

Enter it where?
Windows prompts me when I access the share (\\172.16.19.12\f$).
>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?


You will ahve to execute the process as the admin user.

can you use FTP? it would be a better solution IMO
Yes, that would be good, the only problem is I don't think FTP is running on
the server.

Kev
Jun 25 '07 #8
Hi Kev,

You can use NetUseAdd to use a specific account to connect to the network
share. Please see following thread for a complete discussion (it also has
sample code in C#, though the ACL part isn't relevant here, but I think
it's also useful for reference):

# How to grant Access on Files on a share drive? -
microsoft.public.platformsdk.security | Google Groups
http://groups.google.com/group/micro...curity/browse_
thread/thread/156045ffc5f40605
Hope this helps.
Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Jun 26 '07 #9
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
>




Jun 26 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Alex Vinokur | last post by:
Copying files : input to output =============================== C/C++ Performance Tests ======================= Using C/C++ Program Perfometer http://sourceforge.net/projects/cpp-perfometer...
10
by: Alex Vinokur | last post by:
ofstream outfile ("out"); ifstream infile ("in"); istream_iterator<char> iter(infile), eos; Is it possible to copy 'infile' to 'outfile' using 'iter' and 'eos'? -- Alex Vinokur...
6
by: ReidarT | last post by:
I am copying a file from a network drive to a local PC. Could someone give me a short example on how to get permission to copy the file from R: to C: I have figured out that if I use Imports...
8
by: John Smith | last post by:
Hi folks, I know how to place text into the user's clipboard: Clipboard.SetDataObject("My Copied Text"); but how do I place a file in there? So, if I have a file C:\test.txt, how can I place...
3
by: Peter van der Veen | last post by:
Hi IN VB6 there was a control which you can use to show a small avi when for instance copying files (tyhe flying papers). How can one do that in VB.NET??? Peter
2
by: Frank Rizzo | last post by:
Hello, my app needs to copy a file from local TEMP folder to network share. The network share is accessible via a domain ID. I am trying to call LogonUser API, then ImpersonateLoggedOnUser, then...
8
by: utab | last post by:
Hi there, I am copying one file into another file character by character. I wanted to learn if there is a faster way of doing this? When files get bigger, maybe this can take a lot of time....
2
by: hello123hello | last post by:
I want to run lime wire but it won't let me install it. It always stops at the copying files spot. I use mozilla firefox and i was wondering how do you get Java Runtime Environment to install?
0
by: AmyHanson | last post by:
I am new to mobile development and am having some trouble sources for the tasks I need to perform. I have been looking around and I can find plenty of information on copying the file initiating on...
11
Ali Rizwan
by: Ali Rizwan | last post by:
Hello everybody. I have a problem in fso.copyfiles in vb6.0.Please help me in copying files and how to rename them. Thanks
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.