Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
XML
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

1 solution

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.
 
Share this answer
 
Comments
sreeCoderMan 25-Feb-13 9:09am    
what to write in my webconfig file
ZurdoDev 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
ZurdoDev 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900