I use .net 3.5 and sql membership provider in my website. I ran it successfully with fileupload control on local computer. but when I copied my website to remote website and tried to upload files by fileupload control, I got "access denied" exception with
following details:
Access to the path 'C:\Domains\mywebsite.com\wwwroot\pictures\f24.jpg' 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) 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.
I tried setting the impersonate to true, but I still get this exception. should I give special permissions to my folders on remote website? but how? please help me.
You need to grant the application pool identity, which is likely to be NETWORK SERVICE, access to C:\Domains\mywebsite.com\wwwroot\pictures folder. As indicated in the error message, do the following:
medi_s9
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.
Explorer refers to Windows Explorer, not Internet Explorer...
Thanks
Carsten
Please click Mark as Answer if this post is of help to you. :-)
I did. before I publish the website to my webhost, I granted fullcontrol permission to NETWORK SERVICE for the folder. but I got the exception. then I set impersonate to true and this time I granted fullcontrol permission to MACHINENAME\IIS_IUSRS, but this
didnt work either.
Okay, are you allowing anonymous users to upload, or do they have to login? Is impersonation enabled? If not, what is the account used for the application pool that runs your Web site in IIS?
Thanks
Carsten
Please click Mark as Answer if this post is of help to you. :-)
No, only authenticated users accesses to upload pages and I ran it successfully on local computer without impersonation being enabled. I just created my upload folder in solution explorer and my fileupload control worked correctly.
I dont know what account was used for running my website in IIS. after publish and facing the exception I found out that NETWORK SERVICE and IIS_IUSRS didnt have the write permision, so I granted fullcontrol permission to them which didnt solve the problem.
by default when I create a folder in solution explorer only SYSTEM , ADMINISTRATORS and TRUSTED INSTALLER accounts have the write permission.
Which version of IIS is being used, and do you have access to configuring your web application in IIS? If so, you can see the account used for the application pool in IIS.
Thanks
Carsten
Please click Mark as Answer if this post is of help to you. :-)
I'm running out of ideas here, so try and add the NETWORK SERVICE account to the local Administrators group. I know this is not a good thing, but I simply want to check if that changes anything with regards to the error.
Thanks
Carsten
Please click Mark as Answer if this post is of help to you. :-)
I'm running out of ideas here, so try and add the NETWORK SERVICE account to the local Administrators group. I know this is not a good thing, but I simply want to check if that changes anything with regards to the error.
I really appreciate your patince, but I dont know how to do that!
When I checked IIS manager as you told, I found out that my website was not in the website list which using network service identity, and I discovered that I unawarly had created my web site by file system rather IIS, that was why my website ran correctly
in local. when I configured my website with IIS, this time the exception occured on local, I granted prior permissions to Network service and the error didnt occur anymore. but the exception still occurs on remote server (my webhost)
I have a question; for granting permissions to folders that are in webhost what exactly should I do? should I first grant the permissions to them in local computer and then put them on the webhost? or this granting should be done on web host server and in
order to do that I must contact my webhost provider?
medi_s9
Member
2 Points
16 Posts
Access to the path is denied exception during fileupload.saveas
Dec 06, 2009 09:53 AM|LINK
I use .net 3.5 and sql membership provider in my website. I ran it successfully with fileupload control on local computer. but when I copied my website to remote website and tried to upload files by fileupload control, I got "access denied" exception with following details:
Access to the path 'C:\Domains\mywebsite.com\wwwroot\pictures\f24.jpg' 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) 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.
I tried setting the impersonate to true, but I still get this exception. should I give special permissions to my folders on remote website? but how? please help me.
integrasol
Star
12155 Points
2355 Posts
Re: Access to the path is denied exception during fileupload.saveas
Dec 06, 2009 11:23 AM|LINK
You need to grant the application pool identity, which is likely to be NETWORK SERVICE, access to C:\Domains\mywebsite.com\wwwroot\pictures folder. As indicated in the error message, do the following:
Explorer refers to Windows Explorer, not Internet Explorer...
Carsten
Please click Mark as Answer if this post is of help to you. :-)
My Blog
medi_s9
Member
2 Points
16 Posts
Re: Access to the path is denied exception during fileupload.saveas
Dec 06, 2009 12:12 PM|LINK
thanks for reply,
I did. before I publish the website to my webhost, I granted fullcontrol permission to NETWORK SERVICE for the folder. but I got the exception. then I set impersonate to true and this time I granted fullcontrol permission to MACHINENAME\IIS_IUSRS, but this didnt work either.
integrasol
Star
12155 Points
2355 Posts
Re: Access to the path is denied exception during fileupload.saveas
Dec 06, 2009 12:20 PM|LINK
Okay, are you allowing anonymous users to upload, or do they have to login? Is impersonation enabled? If not, what is the account used for the application pool that runs your Web site in IIS?
Carsten
Please click Mark as Answer if this post is of help to you. :-)
My Blog
medi_s9
Member
2 Points
16 Posts
Re: Access to the path is denied exception during fileupload.saveas
Dec 06, 2009 01:51 PM|LINK
No, only authenticated users accesses to upload pages and I ran it successfully on local computer without impersonation being enabled. I just created my upload folder in solution explorer and my fileupload control worked correctly.
I dont know what account was used for running my website in IIS. after publish and facing the exception I found out that NETWORK SERVICE and IIS_IUSRS didnt have the write permision, so I granted fullcontrol permission to them which didnt solve the problem.
by default when I create a folder in solution explorer only SYSTEM , ADMINISTRATORS and TRUSTED INSTALLER accounts have the write permission.
integrasol
Star
12155 Points
2355 Posts
Re: Access to the path is denied exception during fileupload.saveas
Dec 06, 2009 01:56 PM|LINK
Which version of IIS is being used, and do you have access to configuring your web application in IIS? If so, you can see the account used for the application pool in IIS.
Carsten
Please click Mark as Answer if this post is of help to you. :-)
My Blog
medi_s9
Member
2 Points
16 Posts
Re: Access to the path is denied exception during fileupload.saveas
Dec 06, 2009 02:25 PM|LINK
ok
My IIS version is 6. I checked IIS manager, NETWORK SERVICE is used for application pool.
aggonzalez
Participant
1336 Points
229 Posts
Re: Access to the path is denied exception during fileupload.saveas
Dec 06, 2009 08:50 PM|LINK
Hi medi_s9
Try to give permissions to the user that impersonate the web application.
Another thing you can do is turn off the impersonation and give permissions to the IUSR_computername user.
Please tell me if this helps you to solve your problem.
Greetings and excuse me for my English.
Regards.
--
Alan González
integrasol
Star
12155 Points
2355 Posts
Re: Access to the path is denied exception during fileupload.saveas
Dec 07, 2009 07:00 AM|LINK
I'm running out of ideas here, so try and add the NETWORK SERVICE account to the local Administrators group. I know this is not a good thing, but I simply want to check if that changes anything with regards to the error.
Carsten
Please click Mark as Answer if this post is of help to you. :-)
My Blog
medi_s9
Member
2 Points
16 Posts
Re: Access to the path is denied exception during fileupload.saveas
Dec 07, 2009 09:01 PM|LINK
I really appreciate your patince, but I dont know how to do that!
When I checked IIS manager as you told, I found out that my website was not in the website list which using network service identity, and I discovered that I unawarly had created my web site by file system rather IIS, that was why my website ran correctly in local. when I configured my website with IIS, this time the exception occured on local, I granted prior permissions to Network service and the error didnt occur anymore. but the exception still occurs on remote server (my webhost)
I have a question; for granting permissions to folders that are in webhost what exactly should I do? should I first grant the permissions to them in local computer and then put them on the webhost? or this granting should be done on web host server and in order to do that I must contact my webhost provider?