473,424 Members | 1,941 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,424 software developers and data experts.

Copy files between servers

I have 2 web servers where I need to write a PDF file and need to keep them
in sync. In others words, If the Server1 is getting called to create the
PDF, then it needs to copy the PDF to the other Server2 and visa-versa. The
2 server are running 2003.

It's a form-based authentication (.NET 1.1) site and I'm using IIS 6 native
mode. Both boxes are set to the same workgroup. Since everything is so
locked down now, I'm not sure what's the best way to copy files to another
server from within a VB ASPX page. I've seen some sample impersonation code
but it seems like there would be an easier way.

Thanks,
Chris
Nov 18 '05 #1
8 6191
File.Copy("\\Server1\share\file.abc", "\\Server2\share\file.abc", true)

But before you can do this, you are going to have to impersonate a valid domain user that can perform this operation. This can be done via web.config using

<identity impersonate="true" userName="DOMAIN\bob" password="mypassword" />

But if you don't want your entire application running as this user (I woudln't), you can impersonate via code with examples from this article (you would need to use second way if you have a specific user that you want to use), or the first article if you are using credentials from the authenticated client.

http://support.microsoft.com/default...b;en-us;306158

Hope this helps,
--Michael

"Chris Strobel" <st******@kubota-kma.com> wrote in message news:%2****************@tk2msftngp13.phx.gbl...
I have 2 web servers where I need to write a PDF file and need to keep them
in sync. In others words, If the Server1 is getting called to create the
PDF, then it needs to copy the PDF to the other Server2 and visa-versa. The
2 server are running 2003.

It's a form-based authentication (.NET 1.1) site and I'm using IIS 6 native
mode. Both boxes are set to the same workgroup. Since everything is so
locked down now, I'm not sure what's the best way to copy files to another
server from within a VB ASPX page. I've seen some sample impersonation code
but it seems like there would be an easier way.

Thanks,
Chris

Nov 18 '05 #2
Thanks for the reply Michael...

Is there no way to just have each box trust the other or give the
appropriate rights to each dll assembly?

It seems odd with .NET, that to copy a file between web servers I have to
have 40 or so lines of impersonation code.

Thanks,
Chris

"Raterus" <ra*****@spam.org> wrote in message
news:eC**************@TK2MSFTNGP11.phx.gbl...
File.Copy("\\Server1\share\file.abc", "\\Server2\share\file.abc", true)

But before you can do this, you are going to have to impersonate a valid
domain user that can perform this operation. This can be done via
web.config using

<identity impersonate="true" userName="DOMAIN\bob" password="mypassword" />

But if you don't want your entire application running as this user (I
woudln't), you can impersonate via code with examples from this article (you
would need to use second way if you have a specific user that you want to
use), or the first article if you are using credentials from the
authenticated client.

http://support.microsoft.com/default...b;en-us;306158

Hope this helps,
--Michael

"Chris Strobel" <st******@kubota-kma.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I have 2 web servers where I need to write a PDF file and need to keep them in sync. In others words, If the Server1 is getting called to create the
PDF, then it needs to copy the PDF to the other Server2 and visa-versa. The 2 server are running 2003.

It's a form-based authentication (.NET 1.1) site and I'm using IIS 6 native mode. Both boxes are set to the same workgroup. Since everything is so
locked down now, I'm not sure what's the best way to copy files to another
server from within a VB ASPX page. I've seen some sample impersonation code but it seems like there would be an easier way.

Thanks,
Chris

Nov 18 '05 #3
You mentioned workgroup? Is there really not a domain in this situation? If that is the case, I don't think you can even use impersonation. How does your IIS server sit inside this workgroup? is it one of these two servers? Have you tried just the file.copy code and see what happens?
"Chris Strobel" <st******@kubota-kma.com> wrote in message news:%2****************@tk2msftngp13.phx.gbl...
Thanks for the reply Michael...

Is there no way to just have each box trust the other or give the
appropriate rights to each dll assembly?

It seems odd with .NET, that to copy a file between web servers I have to
have 40 or so lines of impersonation code.

Thanks,
Chris

"Raterus" <ra*****@spam.org> wrote in message
news:eC**************@TK2MSFTNGP11.phx.gbl...
File.Copy("\\Server1\share\file.abc", "\\Server2\share\file.abc", true)

But before you can do this, you are going to have to impersonate a valid
domain user that can perform this operation. This can be done via
web.config using

<identity impersonate="true" userName="DOMAIN\bob" password="mypassword" />

But if you don't want your entire application running as this user (I
woudln't), you can impersonate via code with examples from this article (you
would need to use second way if you have a specific user that you want to
use), or the first article if you are using credentials from the
authenticated client.

http://support.microsoft.com/default...b;en-us;306158

Hope this helps,
--Michael

"Chris Strobel" <st******@kubota-kma.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I have 2 web servers where I need to write a PDF file and need to keep

them
in sync. In others words, If the Server1 is getting called to create the
PDF, then it needs to copy the PDF to the other Server2 and visa-versa.

The
2 server are running 2003.

It's a form-based authentication (.NET 1.1) site and I'm using IIS 6

native
mode. Both boxes are set to the same workgroup. Since everything is so
locked down now, I'm not sure what's the best way to copy files to another
server from within a VB ASPX page. I've seen some sample impersonation

code
but it seems like there would be an easier way.

Thanks,
Chris


Nov 18 '05 #4
The way we resolved this issue is create a user account on each web server
machine with the passwords manually syncronized. The have the Application
Pool in IIS 6.0 run under that account. Each account having the same
username and password, will enable write access.

Can you not just save this file in one location and have both servers pull
from this one location?

HTH,

bill
"Chris Strobel" <st******@kubota-kma.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Thanks for the reply Michael...

Is there no way to just have each box trust the other or give the
appropriate rights to each dll assembly?

It seems odd with .NET, that to copy a file between web servers I have to
have 40 or so lines of impersonation code.

Thanks,
Chris

"Raterus" <ra*****@spam.org> wrote in message
news:eC**************@TK2MSFTNGP11.phx.gbl...
File.Copy("\\Server1\share\file.abc", "\\Server2\share\file.abc", true)

But before you can do this, you are going to have to impersonate a valid
domain user that can perform this operation. This can be done via
web.config using

<identity impersonate="true" userName="DOMAIN\bob" password="mypassword" />
But if you don't want your entire application running as this user (I
woudln't), you can impersonate via code with examples from this article (you would need to use second way if you have a specific user that you want to
use), or the first article if you are using credentials from the
authenticated client.

http://support.microsoft.com/default...b;en-us;306158

Hope this helps,
--Michael

"Chris Strobel" <st******@kubota-kma.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I have 2 web servers where I need to write a PDF file and need to keep

them
in sync. In others words, If the Server1 is getting called to create the
PDF, then it needs to copy the PDF to the other Server2 and visa-versa.

The
2 server are running 2003.

It's a form-based authentication (.NET 1.1) site and I'm using IIS 6

native
mode. Both boxes are set to the same workgroup. Since everything is so
locked down now, I'm not sure what's the best way to copy files to another server from within a VB ASPX page. I've seen some sample impersonation

code
but it seems like there would be an easier way.

Thanks,
Chris


Nov 18 '05 #5
As another option In a workgroup, one could create matching accounts
on both servers.

--
Scott
http://www.OdeToCode.com

On Mon, 26 Jul 2004 12:00:26 -0400, "Raterus" <ra*****@spam.org>
wrote:
You mentioned workgroup? Is there really not a domain in this situation? If that is the case, I don't think you can even use impersonation. How does your IIS server sit inside this workgroup? is it one of these two servers? Have you tried just the file.copy code and see what happens?


Nov 18 '05 #6
Both web servers will sit in a DMZ with same workgroup, separate from the
domain. If I try file.copy I get permission errors. I tried having one box
trust the other assembly and get:

Logon failure: unknown user name or bad password.

Thanks,
Chris

"Raterus" <ra*****@spam.org> wrote in message
news:Ot**************@TK2MSFTNGP12.phx.gbl...
You mentioned workgroup? Is there really not a domain in this situation?
If that is the case, I don't think you can even use impersonation. How does
your IIS server sit inside this workgroup? is it one of these two servers?
Have you tried just the file.copy code and see what happens?
"Chris Strobel" <st******@kubota-kma.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Thanks for the reply Michael...

Is there no way to just have each box trust the other or give the
appropriate rights to each dll assembly?

It seems odd with .NET, that to copy a file between web servers I have to
have 40 or so lines of impersonation code.

Thanks,
Chris

"Raterus" <ra*****@spam.org> wrote in message
news:eC**************@TK2MSFTNGP11.phx.gbl...
File.Copy("\\Server1\share\file.abc", "\\Server2\share\file.abc", true)

But before you can do this, you are going to have to impersonate a valid
domain user that can perform this operation. This can be done via
web.config using

<identity impersonate="true" userName="DOMAIN\bob" password="mypassword" />
But if you don't want your entire application running as this user (I
woudln't), you can impersonate via code with examples from this article (you would need to use second way if you have a specific user that you want to
use), or the first article if you are using credentials from the
authenticated client.

http://support.microsoft.com/default...b;en-us;306158

Hope this helps,
--Michael

"Chris Strobel" <st******@kubota-kma.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I have 2 web servers where I need to write a PDF file and need to keep

them
in sync. In others words, If the Server1 is getting called to create the
PDF, then it needs to copy the PDF to the other Server2 and visa-versa.

The
2 server are running 2003.

It's a form-based authentication (.NET 1.1) site and I'm using IIS 6

native
mode. Both boxes are set to the same workgroup. Since everything is so
locked down now, I'm not sure what's the best way to copy files to another server from within a VB ASPX page. I've seen some sample impersonation

code
but it seems like there would be an easier way.

Thanks,
Chris


Nov 18 '05 #7
Hi Bill,

Wouldn't we have the same permission problem if there was another server
that both Web servers wrote the file to?

I'll try looking at the application pool account.

Thanks,
Chris
"William F. Robertson, Jr." <wfrobertson_at_kpmg_dot_com> wrote in message
news:O2**************@TK2MSFTNGP12.phx.gbl...
The way we resolved this issue is create a user account on each web server
machine with the passwords manually syncronized. The have the Application
Pool in IIS 6.0 run under that account. Each account having the same
username and password, will enable write access.

Can you not just save this file in one location and have both servers pull
from this one location?

HTH,

bill
"Chris Strobel" <st******@kubota-kma.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Thanks for the reply Michael...

Is there no way to just have each box trust the other or give the
appropriate rights to each dll assembly?

It seems odd with .NET, that to copy a file between web servers I have to
have 40 or so lines of impersonation code.

Thanks,
Chris

"Raterus" <ra*****@spam.org> wrote in message
news:eC**************@TK2MSFTNGP11.phx.gbl...
File.Copy("\\Server1\share\file.abc", "\\Server2\share\file.abc", true)

But before you can do this, you are going to have to impersonate a valid
domain user that can perform this operation. This can be done via
web.config using

<identity impersonate="true" userName="DOMAIN\bob" password="mypassword"

/>

But if you don't want your entire application running as this user (I
woudln't), you can impersonate via code with examples from this article

(you
would need to use second way if you have a specific user that you want to use), or the first article if you are using credentials from the
authenticated client.

http://support.microsoft.com/default...b;en-us;306158

Hope this helps,
--Michael

"Chris Strobel" <st******@kubota-kma.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I have 2 web servers where I need to write a PDF file and need to keep

them
in sync. In others words, If the Server1 is getting called to create the PDF, then it needs to copy the PDF to the other Server2 and
visa-versa. The
2 server are running 2003.

It's a form-based authentication (.NET 1.1) site and I'm using IIS 6

native
mode. Both boxes are set to the same workgroup. Since everything is so
locked down now, I'm not sure what's the best way to copy files to

another server from within a VB ASPX page. I've seen some sample impersonation

code
but it seems like there would be an easier way.

Thanks,
Chris



Nov 18 '05 #8
Yes, that would be resolved from the application pool identity.

http://msdn.microsoft.com/library/de...olsettings.asp

It was more commentary on keeping two different data stores in two different
locations.

HTH,

bill

"Chris Strobel" <st******@kubota-kma.com> wrote in message
news:ut**************@TK2MSFTNGP11.phx.gbl...
Hi Bill,

Wouldn't we have the same permission problem if there was another server
that both Web servers wrote the file to?

I'll try looking at the application pool account.

Thanks,
Chris
"William F. Robertson, Jr." <wfrobertson_at_kpmg_dot_com> wrote in message
news:O2**************@TK2MSFTNGP12.phx.gbl...
The way we resolved this issue is create a user account on each web server
machine with the passwords manually syncronized. The have the Application Pool in IIS 6.0 run under that account. Each account having the same
username and password, will enable write access.

Can you not just save this file in one location and have both servers pull from this one location?

HTH,

bill
"Chris Strobel" <st******@kubota-kma.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Thanks for the reply Michael...

Is there no way to just have each box trust the other or give the
appropriate rights to each dll assembly?

It seems odd with .NET, that to copy a file between web servers I have to have 40 or so lines of impersonation code.

Thanks,
Chris

"Raterus" <ra*****@spam.org> wrote in message
news:eC**************@TK2MSFTNGP11.phx.gbl...
File.Copy("\\Server1\share\file.abc", "\\Server2\share\file.abc", true)
But before you can do this, you are going to have to impersonate a valid domain user that can perform this operation. This can be done via
web.config using

<identity impersonate="true" userName="DOMAIN\bob" password="mypassword" />

But if you don't want your entire application running as this user (I
woudln't), you can impersonate via code with examples from this
article
(you
would need to use second way if you have a specific user that you want

to use), or the first article if you are using credentials from the
authenticated client.

http://support.microsoft.com/default...b;en-us;306158

Hope this helps,
--Michael

"Chris Strobel" <st******@kubota-kma.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
> I have 2 web servers where I need to write a PDF file and need to
keep them
> in sync. In others words, If the Server1 is getting called to create

the > PDF, then it needs to copy the PDF to the other Server2 and visa-versa. The
> 2 server are running 2003.
>
> It's a form-based authentication (.NET 1.1) site and I'm using IIS 6
native
> mode. Both boxes are set to the same workgroup. Since everything is so > locked down now, I'm not sure what's the best way to copy files to

another
> server from within a VB ASPX page. I've seen some sample impersonation code
> but it seems like there would be an easier way.
>
> Thanks,
> Chris
>
>



Nov 18 '05 #9

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

Similar topics

7
by: Markus Weber | last post by:
Hallo! I have created an VB-ActiveX-Componente that copy files on network. This works on one my development computer when I install application on other IIS servers (files to copy on same server...
0
by: durumdara | last post by:
Hi ! I have some backup files on a server farm. I want to store these local backup files on a backup file server for "safety's snake". These files are compressed zip files with 12 character...
0
by: rajani | last post by:
I have requirement to copy files to SAN and NAS . I am new to this . I just know SAN/NAS act like servers. Is it like copy files to any other drive or special handling has to be done. Any help is...
1
by: Green | last post by:
Hi, I had a question about how to copy files from server to server on the same LAN. Basically, i need to copy files from "develope server" to the "test server", then eventually to the "production...
2
by: Xavier Valdés | last post by:
Hi all, I would like to copy FILES from the clipboard to a desired folder from VB.NET. I was able to copy files (with filedrop data format) to the clipboard but I don't know how to catch this...
4
by: sajid_yusuf | last post by:
Hi I am trying to develop a Windows service in VB.NET which has timer enabled and keeps checking a folder (or group of folders) for any new file or changed files. As soon as it detects any new...
1
by: dkmarni | last post by:
Hi, I am trying to do this perl script, but not able to complete it successfully. Here is the description what the script has to do.. Accept two and only two command line arguments. Again,...
3
by: =?Utf-8?B?U2Vhbk1hYw==?= | last post by:
How do I programmatically copy files across a network (from a local workstation to another local workstation on the network) using visual basic 2005? In other words, when in explorer and you enter...
2
by: parmarjm | last post by:
Hi I am trying to copy files from mapped drive (J:\) to a different machine. The perl script is going to run on my machine to copy files from one place to another. File transfer works when i copy...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
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...

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.