Click here to Skip to main content
15,354,542 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
hi all :)

I have an upload control

and when I upload an image to pictures folder, i got this message


System.UnauthorizedAccessException was unhandled by user code
Message=Access to the path is denied.

what is the problem, and how can i solve it ?



thank you all :)
Posted
Comments
Sergey Alexandrovich Kryukov 23-Sep-11 19:33pm
   
You could provide some code sample. As you did not do it, my answer is based on my educated guess.
--SA

It happens all the time. Remember, you cannot access any directories in the server's file systems beyond the root directory of your site. Also, your directory should provide right access to everyone. When you process post data on the server side, you need to calculate your directory where you write files relative to this root directory.

From the client point of view, all the path names of the directories should be relative to the page where the link is used. Alternatively they can be HTTP addresses having the addresses like http://subdomain.domain.tld mapped to the root directory of your site.

—SA
   
Comments
Simon Bang Terkildsen 23-Sep-11 19:35pm
   
my 5, though a quick google by the OP would have yielded tons of results
Sergey Alexandrovich Kryukov 23-Sep-11 19:38pm
   
True. Also, the proper way of saving file can be relatively easy found by combination of some experimenting and reading. Unfortunately, actual source of OP's problem is unknown, but most people do the same mistakes.
Thank you, Simon.
--SA
Rajesh Anuhya 11-Nov-11 2:19am
   
Good Answer +5,
@OP See my answer for the diff. permission on folders
   
Thank you, Rajesh.
--SA
   
v2
Comments
   
1) First link is broken, 2) should not be in <pre>...</pre>
Please fix. I already voted 5 (in advance, though!) for the second links with is useful.
--SA
You refer this site this may help you..

http://forums.digitalpoint.com/showthread.php?t=120863[^]
   
go through the below link for folder permissions
http://support.microsoft.com/kb/308419[^]
   

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