471,350 Members | 1,609 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

File.Copy Access Denied

Hi All,
I have creating an ASP.Net application with two web servers. I am
uploading a file which is being uploaded on one of the server, I want to
copy the uploaded file on the other server at the same time.

It says Access Denied.

I am using File.Copy ( Source , Destination , true ) command in my code,
where
Source : the current physical location of the uploaded file
Destination : the physical location of the other server i.e.
\\IPAddress\SharedFolder
True : To overwrite the file if it exists

I have given rights for everyone on SharedFolder, but still it says Access
denied.

Is it that I have to provide login and pwd in my code.
Is it that I have to NetworkCredential class in my code? if Yes how do I
do.

What is that I am missing?
How do i give rights of ASPNet user of one machine to shared folder of other
machine.

Thanks for your help,
Shailesh Gajare


Nov 19 '05 #1
3 3912
Im not quite sure if unerstand you. On the Server you are uloading the
file, but at the same time you want to copy the file you are writing to to
another file ?

If so, then it will probably deny you access because of the mode in which it
uploads. You will probably have to wait until the file upload has completed
to do this.

Mr N

"Shailesh Gajare" <sh*************@ideaPool.com> wrote in message
news:ed**************@TK2MSFTNGP14.phx.gbl...
Hi All,
I have creating an ASP.Net application with two web servers. I am
uploading a file which is being uploaded on one of the server, I want to
copy the uploaded file on the other server at the same time.

It says Access Denied.

I am using File.Copy ( Source , Destination , true ) command in my code,
where
Source : the current physical location of the uploaded file
Destination : the physical location of the other server i.e.
\\IPAddress\SharedFolder
True : To overwrite the file if it exists

I have given rights for everyone on SharedFolder, but still it says Access
denied.

Is it that I have to provide login and pwd in my code.
Is it that I have to NetworkCredential class in my code? if Yes how do I
do.

What is that I am missing?
How do i give rights of ASPNet user of one machine to shared folder of
other
machine.

Thanks for your help,
Shailesh Gajare

Nov 19 '05 #2

I tried doing this in debug mode and waited for time to upload the file. I
went to the server to check the file has uploaded perfectly or not then,
then i countinued to debug the lines of copying the same file from Server1
to server2.
It says access denied....

Is there any way by which we can add networkcredential class object to
file.copy command, so that it works.

Any other help?
Shailesh G
"Mr Newbie" <he**@now.com> wrote in message
news:O6*************@tk2msftngp13.phx.gbl...
Im not quite sure if unerstand you. On the Server you are uloading the
file, but at the same time you want to copy the file you are writing to to
another file ?

If so, then it will probably deny you access because of the mode in which
it uploads. You will probably have to wait until the file upload has
completed to do this.

Mr N

"Shailesh Gajare" <sh*************@ideaPool.com> wrote in message
news:ed**************@TK2MSFTNGP14.phx.gbl...
Hi All,
I have creating an ASP.Net application with two web servers. I am
uploading a file which is being uploaded on one of the server, I want to
copy the uploaded file on the other server at the same time.

It says Access Denied.

I am using File.Copy ( Source , Destination , true ) command in my code,
where
Source : the current physical location of the uploaded file
Destination : the physical location of the other server i.e.
\\IPAddress\SharedFolder
True : To overwrite the file if it exists

I have given rights for everyone on SharedFolder, but still it says
Access
denied.

Is it that I have to provide login and pwd in my code.
Is it that I have to NetworkCredential class in my code? if Yes how do I
do.

What is that I am missing?
How do i give rights of ASPNet user of one machine to shared folder of
other
machine.

Thanks for your help,
Shailesh Gajare


Nov 19 '05 #3
OK, now I think I understand. If the account on the upload server (
Server1 ) is local account then you will need to add this file to a DOMAIN
GLOBAL Group and add the group with write permissions to the target
server\directory.

HTH Mr N.
"Shailesh Gajare" <sh*************@ideaPool.com> wrote in message
news:u3**************@TK2MSFTNGP15.phx.gbl...

I tried doing this in debug mode and waited for time to upload the file. I
went to the server to check the file has uploaded perfectly or not then,
then i countinued to debug the lines of copying the same file from Server1
to server2.
It says access denied....

Is there any way by which we can add networkcredential class object to
file.copy command, so that it works.

Any other help?
Shailesh G
"Mr Newbie" <he**@now.com> wrote in message
news:O6*************@tk2msftngp13.phx.gbl...
Im not quite sure if unerstand you. On the Server you are uloading the
file, but at the same time you want to copy the file you are writing to
to another file ?

If so, then it will probably deny you access because of the mode in which
it uploads. You will probably have to wait until the file upload has
completed to do this.

Mr N

"Shailesh Gajare" <sh*************@ideaPool.com> wrote in message
news:ed**************@TK2MSFTNGP14.phx.gbl...
Hi All,
I have creating an ASP.Net application with two web servers. I am
uploading a file which is being uploaded on one of the server, I want to
copy the uploaded file on the other server at the same time.

It says Access Denied.

I am using File.Copy ( Source , Destination , true ) command in my code,
where
Source : the current physical location of the uploaded file
Destination : the physical location of the other server i.e.
\\IPAddress\SharedFolder
True : To overwrite the file if it exists

I have given rights for everyone on SharedFolder, but still it says
Access
denied.

Is it that I have to provide login and pwd in my code.
Is it that I have to NetworkCredential class in my code? if Yes how do I
do.

What is that I am missing?
How do i give rights of ASPNet user of one machine to shared folder of
other
machine.

Thanks for your help,
Shailesh Gajare



Nov 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Divya | last post: by
2 posts views Thread by Stephen Witter | last post: by
2 posts views Thread by Shailesh Gajare | last post: by
5 posts views Thread by wo20051223 | last post: by
11 posts views Thread by trs-ggcsea | last post: by
4 posts views Thread by Thelma Lubkin | last post: by
9 posts views Thread by pooba53 | last post: by
reply views Thread by XIAOLAOHU | last post: by

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.