Click here to Skip to main content
15,920,633 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all, I have a web page which allows only logged in users to write to a file on the server. When I try to write to a file on the server by clicking the Save button, I get the following error
C#
Access to the path 'G:\PleskVhosts\MySite.com\httpdocs\images\Five.png' is denied.

The error message also said the following
ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity.

I am using Form authentication and I've tried to implement impersonation but it did not work. Can anyone please tell me how to grant access to resources on the server, thanks in advance.
Posted

Provide full Access of folder as well as files .
go your FTP Control Panel and change folder/Directory Permission .
otherwise you share your problem with service provider And say give me file Permission for save in a folder .
 
Share this answer
 
v2
provide full access on that folder for login user of window.
 
Share this answer
 
v2
First of all don't use any random drive in server as in future you may not have access to that. So use user specific path on the server which would never throw an error.

Use below code for any kind of manipulation of files.
C#
string path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);


Always use this path for saving and accessing files.
 
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