473,569 Members | 2,701 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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\Sha redFolder
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 NetworkCredenti al 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 4039
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******** ******@TK2MSFTN GP14.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\Sha redFolder
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 NetworkCredenti al 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 networkcredenti al 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******** *****@tk2msftng p13.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******** ******@TK2MSFTN GP14.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\Sha redFolder
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 NetworkCredenti al 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\director y.

HTH Mr N.
"Shailesh Gajare" <sh************ *@ideaPool.com> wrote in message
news:u3******** ******@TK2MSFTN GP15.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 networkcredenti al 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******** *****@tk2msftng p13.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******** ******@TK2MSFTN GP14.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\Sha redFolder
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 NetworkCredenti al 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
15978
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 - http://www.codeproject.com/useritems/ZetaImpersonator.asp 2. Using WebRequest object to write the file to the destination domain -...
2
4240
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, they are supposed to get overwritten, but I'm getting an access denied error. The files that are currently there have RA permissions. If i remove...
2
3757
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 it on the web server but not from a client. Here is the code: Dim impersonationContext As System.Security.Principal.WindowsImpersonationContext...
2
3774
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 same time. It says Access Denied. I am using File.Copy ( Source , Destination , true ) command in my code, where Source : the current...
5
38976
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 Explorer. I can delete all of them through Windows Explorer. I can programmatically delete the text file but not the others. Permissions: - All...
11
55895
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 model, or because I need to implement impersonation of some sort. I was hoping someone could point me to an answer or the appropriate documentation, as...
4
4325
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. thanks, --thelma
9
3917
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 import a backup copy of this Access db if they need to. I'm using the FileCopy method to simply copy over the data.mdb file within the directory...
1
15027
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 hosted on IIS 6.0 (W2K3). We need to restrict access to specific users within our company network. To reduce development effort I figured the easiest...
0
7697
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7612
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...
0
7924
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
6283
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...
1
5512
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3653
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...
0
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
937
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...

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.