Click here to Skip to main content
15,891,657 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I have a project uploading a file. When user upload a file, the file is stored in ~\preupload folder in my project. When user enter other infos and press the "update" button, I try to move the file to shared folder on another machine.

Code like this:

string sourcepath = Session["SourcePath"].ToString(); //full file path in this.
string targetpath = "\\otherserver\sharedFolder\" + filename;

File.Move(sourcepath,targetpath);


And I'm getting "access denied" error.

I give a domain user to application pool identity. Target Folder has a "everyone read/write" permission.
And if I give a folder on the ISS server as a targetpath, file moved correctly. But I cant move it to another server machine.

Anyone help pls?

Many thanks.
Posted
Updated 22-Sep-14 1:39am
v2
Comments
[no name] 22-Sep-14 7:43am    
Check your paths. At least your targetpath string would not be a valid path, as given in your example.
Kornfeld Eliyahu Peter 22-Sep-14 7:44am    
Check permission on the share and not on the target...
g.ozcelik 22-Sep-14 9:11am    
Thank you for quick response.
I checked the source folder permission. Error details say that target path has a "access denied".

Am I do anything special for accessing path of another server? I can write my file to a path in the same server. (like: \\myserver\uploadedfiles) but i cant write it to another server (like: \\otherserver\uploadedfiles).
Boths have "everyone r/w".

Thanks.

Check the destination path folder permission, It should be globally shared for every one.
 
Share this answer
 
Hi again,

I use "system.io.file.move()" method to copy file.

If destination folder is in the same server, no error. But if dest.folder is in another server, i'm getting error:
Quote:
Access to the path is denied.-- Source:mscorlib at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)


For example: My asp application run on MYSERVER
If dest. folder is "\\MYSERVER\uploadedfiles\", everthing ok.
But if dest. folder is "\\OTHERSERVER\uploadedfiles\", access denied.

"\\OTHERSERVER\uploadedfiles\" has everyone read/write permission. Why I am getting access denied error?

Thanks for your reply.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900