Click here to Skip to main content
15,914,225 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
 i make a page from which i upload image but it gives error , can anybody help 


Exception Details: System.UnauthorizedAccessException: Access to the path 'D:\INETPUB\VHOSTS\apunkashaher.com\httpdocs\tree\image.jpg' is denied. 

ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6 and IIS 7, and the configured application pool identity on IIS 7.5) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user. 

To grant ASP.NET access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.
Posted

1 solution

The error message is so explanatory. The asp.net process under which you application is running do not have 'write' access to the folder where you are trying to store the file. The is a default behaviour and implemented for obvious security reasons.
This should help you - http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.fileupload.aspx#security_considerations[^]
 
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