Upload file permission denied
-
Hi all, I m trying to upload file on sever through upload control. code is working fine in local environment. also i have test code in asp. But when i have deployed the same asp.net code on server, getting this error.... Access to the path 'e:\Inetpub\herddealers.com\wwwroot\admin\resources\Book1.xls' 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 'e:\Inetpub\xyz.com\wwwroot\admin\resources\Book1.xls' 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. code in asp to upload file in same folder is working fine but not in asp.net. can any 1 know the reason... plz help me to resolve this issue...
Regards... Vijay Jain :)
"One thing you can't recycle is wasted time."
-
Hi all, I m trying to upload file on sever through upload control. code is working fine in local environment. also i have test code in asp. But when i have deployed the same asp.net code on server, getting this error.... Access to the path 'e:\Inetpub\herddealers.com\wwwroot\admin\resources\Book1.xls' 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 'e:\Inetpub\xyz.com\wwwroot\admin\resources\Book1.xls' 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. code in asp to upload file in same folder is working fine but not in asp.net. can any 1 know the reason... plz help me to resolve this issue...
Regards... Vijay Jain :)
"One thing you can't recycle is wasted time."
Jain Vijay wrote:
I m trying to upload file on sever through upload control. code is working fine in local environment. also i have test code in asp. But when i have deployed the same asp.net code on server, getting this error....
Vijay, This is the problem with Access permissions on web server. Let me discussed it in details. Why it was working on Local Environment ? Becuase, In VS, you application is running by
ASP.NET Engine
, which having the all rights to write data on your system, so its working fine on Local Enviroment. Why not in Hosted Server ? Web Appliction runs on server with some limited permission for security reasons and user does not have the suficient permission to write data on Folder. So you are getting the Error. Resolution : 1. Give theFull Access rights
to all the user on the folder where you are storing the file. 2. Create a Separate Application Pool on Web server, Change the Identity of Application pool to "Local System
" ( Which having the maximum permissions) . And assigned it to your virtual directory. Hope this details explained will help you :-DAbhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you. View My Latest Article
-
Jain Vijay wrote:
I m trying to upload file on sever through upload control. code is working fine in local environment. also i have test code in asp. But when i have deployed the same asp.net code on server, getting this error....
Vijay, This is the problem with Access permissions on web server. Let me discussed it in details. Why it was working on Local Environment ? Becuase, In VS, you application is running by
ASP.NET Engine
, which having the all rights to write data on your system, so its working fine on Local Enviroment. Why not in Hosted Server ? Web Appliction runs on server with some limited permission for security reasons and user does not have the suficient permission to write data on Folder. So you are getting the Error. Resolution : 1. Give theFull Access rights
to all the user on the folder where you are storing the file. 2. Create a Separate Application Pool on Web server, Change the Identity of Application pool to "Local System
" ( Which having the maximum permissions) . And assigned it to your virtual directory. Hope this details explained will help you :-DAbhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you. View My Latest Article
Hi Abhijit, thnx for your reply. Further, on folder full access is already given. Also i am able to upload file in same folder from ASP application. but not be able from asp.net application. My server is shared server and i have no permission to create application pool. Is there any other way to set this issue? Thanx...
Regards... Vijay Jain :)
"One thing you can't recycle is wasted time."
-
Hi Abhijit, thnx for your reply. Further, on folder full access is already given. Also i am able to upload file in same folder from ASP application. but not be able from asp.net application. My server is shared server and i have no permission to create application pool. Is there any other way to set this issue? Thanx...
Regards... Vijay Jain :)
"One thing you can't recycle is wasted time."
Jain Vijay wrote:
on folder full access is already given.
To whom ? Is it given to every one?
Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you. View My Latest Article
-
Jain Vijay wrote:
on folder full access is already given.
To whom ? Is it given to every one?
Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you. View My Latest Article
Hi Abhijit, Problem is resolved. In web.config file, under tag was needed. After add this tag, now code is working fine on server.
Regards... Vijay Jain :)
"One thing you can't recycle is wasted time."
-
Hi Abhijit, Problem is resolved. In web.config file, under tag was needed. After add this tag, now code is working fine on server.
Regards... Vijay Jain :)
"One thing you can't recycle is wasted time."
Jain Vijay wrote:
Problem is resolved.
Great Vijay !! Please share us the web.config block. Which may helps others. In you post its not showing, Please
Checked
the Do not interpret HTML tags (good for code snippets) checbox before post.Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you. View My Latest Article
-
Jain Vijay wrote:
Problem is resolved.
Great Vijay !! Please share us the web.config block. Which may helps others. In you post its not showing, Please
Checked
the Do not interpret HTML tags (good for code snippets) checbox before post.Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you. View My Latest Article
Hi Abhijit, here is s web.config block... <system.web> <identity impersonate="true"/> </system.web>
Regards... Vijay Jain :)
"One thing you can't recycle is wasted time."