473,287 Members | 1,946 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,287 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 4023
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Divya | last post by:
Hello, I am trying to copy a file from one domain to another. I have the username and password of the destination domain. I tried a few approaches - 1. Using the Impersonator Class -...
2
by: Narshe | last post by:
I have a custom action for my msi installer where you select a directory, and some files get copied to that directory. I'm using System.IO.File.Copy() to copy them. If the files are already there,...
2
by: Stephen Witter | last post by:
I had previously posted this on the security ng, but haven't had a hit so I was wondering if someone here would be willing to take a stab. I am trying to copy a file to a network drive. I can do...
2
by: Shailesh Gajare | last post by:
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...
5
by: wo20051223 | last post by:
Deleting some files with C# fails with "Access to the path 'X' is denied". I have files copied from a CD that I burned (and not locked by a process) and a text file that I created in Windows...
11
by: trs-ggcsea | last post by:
Hi, I am reading a file from a UNC path in my Visual studio 2005 C# (.NET 2) program and getting an access denied exception. I am unsure if this access denied is due to the .NET security...
4
by: Thelma Lubkin | last post by:
I need to copy a file in a VBA module of an Access form, and I haven't been able to find out how to do it: just cp /Path1/file1 /Path2/file2 Please show me how to do this in VBA for Windows....
9
by: pooba53 | last post by:
My VB .NET application (created in VS 2003) resides in c:\Program Files \Test\ and there's a data.mdb (Access) file within this directory. I have a feature in my program that allows the user to...
1
by: JordanRieger | last post by:
Here is a nasty issue that has been giving me grief for the last couple days. This requires good knowledge of IIS, MSXML, and Windows/NTFS permissions. We have an existing ASP (VBScript) app...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
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: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
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: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

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.