Click here to Skip to main content
13,344,273 members (54,897 online)
Rate this:
Please Sign up or sign in to vote.
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) 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.

Source Error:

Line 230:        //            string filename = Path.GetFileName(pimageupload.FileName);
Line 231:        Utils.ImagePathSave = "Images/" + filename1;
Line 232:        pimageupload.SaveAs(Server.MapPath(Utils.ImagePathSave));
Line 233:        //            lblSt1.Text = "successfully uploded in server";
Line 234:        //        }
Posted 25-Feb-13 4:00am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

The error is actually telling you what you need to do. You need to grant permissions to the account that is running the code. That account needs permissions to the folder where you are trying to save the image.

It depends on your web.config settings and IIS as to what account that is.
sreeCoderMan 25-Feb-13 9:09am
what to write in my webconfig file
ryanb31 25-Feb-13 9:37am
No, you don't change anything in web.config. You need to determine what account is being used to run your app. For example, if it is configured in IIS, then it is the identity in your app pool unless you have impersonation turned on. So, it depends on how you have things setup.
sreeCoderMan 26-Feb-13 5:54am
i cant understand......... can you please explain ones more
ryanb31 26-Feb-13 7:37am
What's your OS? Is your site configured in IIS or just through Visual Studio? Go to the properties of your website in Visual Studio and click the Web tab. There is a section called Servers. See if you are using IIS or Visual Studio.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.180111.1 | Last Updated 25 Feb 2013
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100