By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,290 Members | 1,414 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,290 IT Pros & Developers. It's quick & easy.

Copy files between servers

P: n/a
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
Share this Question
Share on Google+
8 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.