473,662 Members | 2,595 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 12008
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.comw rote 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**********@g mail.comwrote in message
news:Ow******** ******@TK2MSFTN GP03.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.comw rote 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.comw rote 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**********@g mail.comwrote in message
news:Ow******** ******@TK2MSFTN GP03.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.comw rote 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**********@g mail.comwrote in message
news:%2******** ********@TK2MSF TNGP02.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.comw rote 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**********@g mail.comwrote in message
news:Ow******* *******@TK2MSFT NGP03.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.comw rote in message
news:f5****** ****@newsfeed.t h.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.comw rote 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.comw rote 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******** *****@TK2MSFTNG P04.phx.gbl...
Hi,

"Mantorok" <no**@none.comw rote 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.publi c.platformsdk.s ecurity | Google Groups
http://groups.google.com/group/micro...curity/browse_
thread/thread/156045ffc5f4060 5
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 ConsoleApplicat ion1.exe using the code below:

using System;
using System.IO;
using System.Diagnost ics;

namespace ConsoleApplicat ion1
{
/// <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\MyTes t.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(pat h)) {}

// Ensure that the target does not exist.
File.Delete(pat h2);

// Copy the file.
File.Copy(path, path2);
Console.WriteLi ne("{0} copied to {1}", path, path2);

// Try copy the file, which should succeed.
File.Copy(path, path2, true);
EventLog.WriteE ntry("FileCopyO verDMZ-Scheduled Task","Successf ully
Copied!!!", EventLogEntryTy pe.Warning);
}

catch (Exception e)
{
EventLog.WriteE ntry("FileCopyO verDMZ-Scheduled Task",e.Message ,
EventLogEntryTy pe.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.comw rote 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**********@g mail.comwrote in message
news:%2******** ********@TK2MSF TNGP02.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.comw rote 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**********@g mail.comwrote in message
news:Ow****** ********@TK2MSF TNGP03.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.comw rote 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
2973
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 http://alexvn.freeservers.com/s1/perfometer.html
10
2809
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 mailto:alexvn@connect.to http://mathforum.org/library/view/10978.html
6
2606
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 System.Security.Permissions and Dim oFp As FileIOPermission = New _
8
16207
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 that file into the user's clipboard so that they can later paste it into explorer? Thanks!!!
3
2258
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
2179
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 copy the file to this share. But I keep on getting errors. Even though all the APIs return success, copying files still comes back with "Access denied" type of errors. Am I missing something here? Thanks
8
15753
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. Thanks for the replies in advance.
2
1143
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
2498
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 the PC end, I need it to initiate on the Mobile Device end. I need the handheld to be the device that is initiating the file copy as it is the only one that knows the name of the file(s) to be copied. I have found numerous references to using RAPI...
11
7715
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
8344
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8764
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8546
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7367
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5654
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4180
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4347
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1993
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1752
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.