Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Upload file permission denied

Upload file permission denied

Scheduled Pinned Locked Moved ASP.NET
helpasp-netsysadmincsharpcom
7 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jain Vijay
    wrote on last edited by
    #1

    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."

    A 1 Reply Last reply
    0
    • J Jain Vijay

      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."

      A Offline
      A Offline
      Abhijit Jana
      wrote on last edited by
      #2

      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 the Full 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 :-D

      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

      J 1 Reply Last reply
      0
      • A Abhijit Jana

        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 the Full 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 :-D

        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

        J Offline
        J Offline
        Jain Vijay
        wrote on last edited by
        #3

        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."

        A 1 Reply Last reply
        0
        • J Jain Vijay

          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."

          A Offline
          A Offline
          Abhijit Jana
          wrote on last edited by
          #4

          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

          J 1 Reply Last reply
          0
          • A Abhijit Jana

            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

            J Offline
            J Offline
            Jain Vijay
            wrote on last edited by
            #5

            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."

            A 1 Reply Last reply
            0
            • J Jain Vijay

              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."

              A Offline
              A Offline
              Abhijit Jana
              wrote on last edited by
              #6

              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

              J 1 Reply Last reply
              0
              • A Abhijit Jana

                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

                J Offline
                J Offline
                Jain Vijay
                wrote on last edited by
                #7

                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."

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups