Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#2.0 C++ C C# ASP ASP.NET HTML , +
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 3:00am

1 solution

Rate this: bad
good
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.
  Permalink  
Comments
sreeCoderMan at 25-Feb-13 9:09am
   
what to write in my webconfig file
ryanb31 at 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 at 26-Feb-13 5:54am
   
i cant understand......... can you please explain ones more
ryanb31 at 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
0 Sergey Alexandrovich Kryukov 410
1 Maciej Los 280
2 OriginalGriff 248
3 CHill60 186
4 Sinisa Hajnal 145


Advertise | Privacy | Mobile
Web01 | 2.8.141022.2 | Last Updated 25 Feb 2013
Copyright © CodeProject, 1999-2014
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