Click here to Skip to main content
15,885,032 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
When I trying to upload an image file to webserver using ASP.NET it through an exception "Access denied". I've used the following code to upload image file:

C#
ImageUploader.PostedFile.SaveAs(Server.MapPath(imagePath) + imageName);


But, When I try to upload an image file by classic asp in same server it works.

When I set <identity impersonate="true"> in web.config file image uploading works in asp.net. But in that case crystal report is not working.

So, my question is there any permission or security related issue in web-server or there is problem in my code.
Posted
Updated 24-Nov-11 0:35am
v2

Try by providing Full-Rights permissions to "IIS_IUSRS" and "Network Services" Accounts to your Folder in which you are uploading Files.
 
Share this answer
 
Comments
here_is_kunal 24-Nov-11 7:05am    
thanks for your reply. Do you have any idea in Classic ASP how it works?
RaisKazi 24-Nov-11 7:41am    
Have a look at below link for more information on this.
http://imar.spaanjaars.com/287/how-do-i-determine-the-security-account-that-iis-uses-to-run-my-web-site
yes give full rights to Network Services user as RaisKazi told.
in Impersonation use UserId and Password. Impersonation suggest on whos behalf you are running web application
HTML
<identity impersonate="true" username="Administrator" password="PWD" />
 
Share this answer
 
Comments
here_is_kunal 24-Nov-11 7:05am    
thanks for your reply. Do you have any idea in Classic ASP how it works?

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