Click here to Skip to main content
15,916,398 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Access to the path 'D:\PLESKVHOST\vhosts\abhisaartechnologies.com\vns.abhisaartechnologies.com\Upload\resturent.png' is denied.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.UnauthorizedAccessException: Access to the path 'D:\PLESKVHOST\vhosts\abhisaartechnologies.com\vns.abhisaartechnologies.com\Upload\resturent.png' 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 File 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.

Source Error:


Line 25: {
Line 26: string filename = Path.GetFileName(FileUpload1.PostedFile.FileName);
Line 27: FileUpload1.SaveAs(Server.MapPath("~/Upload/" + filename));
Line 28: SqlConnection con = new SqlConnection(constr);
Line 29: con.Open();


Source File: d:\pleskvhost\vhosts\abhisaartechnologies.com\vns.abhisaartechnologies.com\Cpanel\Category.aspx.cs Line: 27

this is my code:--
protected void btnsubmit_Click(object sender, EventArgs e)
{
string filename = Path.GetFileName(FileUpload1.PostedFile.FileName);
FileUpload1.SaveAs(Server.MapPath("Upload/" + filename));
SqlConnection con = new SqlConnection(constr);
con.Open();
SqlCommand com = new SqlCommand("Insert into tbl_CategoryMaster (Category,catId,CatImage) values(@Category,@catId,@CatImage)", con);
com.Parameters.AddWithValue("@Category", SqlDbType.NVarChar).Value = txtcat.Text;
com.Parameters.AddWithValue("@catId", SqlDbType.NVarChar).Value = txtid.Text;
com.Parameters.AddWithValue("@CatImage", filename);
int obj = Convert.ToInt32(com.ExecuteNonQuery());
if (obj > 0)
{
Label1.Text = "Save";
}
else
{
Label1.Text = "Try Again";
}
con.Close();
txtcat.Text = "";
}
plz help me sir how to solve problem
Posted
Updated 27-May-18 2:35am

Set folder Permission IIS user (Full Control)
 
Share this answer
 
Comments
Member 10506503 8-Jul-15 8:32am    
how to set folder Permission IIS user sir?
plz Guide Me sir
hi,

As the error message clearly states that the application doesn't have the privilege to access.

First, get to know all the IIS user accounts and check your appPool is running unde which account.

Give the permissions accordingly.

In your case, you have to give permission to this path
D:\PLESKVHOST\vhosts\abhisaartechnologies.com\vns.abhisaartechnologies.com\Upload\


Check this link for detail info
http://stackoverflow.com/questions/5729264/what-are-all-the-user-accounts-for-iis-asp-net-and-how-do-they-differ[^]

Hope this helps.
 
Share this answer
 
Ok, so I just worked this issue out with a GoDaddy rep and let me tell you it was not easy.

Here's what you do in Plesk admin panel. Go to the Root directory and put your mouse over your website folder on the right. A tiny arrow shows up on the right of the folder name.

Once you go into that screen it's pretty much self-explanatory. Click the check box for "Replace permission entries on all child objects with the entries displayed here", choose the App Pool Group and add the "Modify" permissions.

Then click on the "Ok" button in the bottom and you're ready to go.

That should fix this issue for you.

Good luck.
 
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