SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot pavanpuligandla's Avatar
    Join Date
    Sep 2008
    Location
    hyderabad
    Posts
    179
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    System.UnauthorizedAccessException in c#

    Hii,
    i created a .aspx web form which deals with file uplaod, users has to upload their .doc. .txt files, when uploaded successfully sent to a folder named uplaods.
    when i tested the same on my localhost, it worked and i can see the file also.
    but when i uplaoded to my server, i can see this error. after studying tht, i tried by adding this line to web.config file.
    i actually dont know those username and passwords.
    heres my ERROR message, can anyone kindly suggest me wht to do now.

    ccess to the path 'D:\inetpub\vhosts\xyz.com\httpdocs\xyz\Website\ing\uploads\Update.txt' 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 'D:\inetpub\vhosts\xyz.com\httpdocs\xyz\Website\ing\uploads\Update.txt' 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 gave the folder path correctly..
    many thanks
    PHP Professional turned ASP.NET Professional

  2. #2
    SitePoint Guru
    Join Date
    Nov 2005
    Location
    Norway
    Posts
    715
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi
    Did you do what the error message said?
    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.
    Give the aspnet machine account modify rights on the folder Upload.

  3. #3
    SitePoint Zealot pavanpuligandla's Avatar
    Join Date
    Sep 2008
    Location
    hyderabad
    Posts
    179
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hii
    I tried it to implement the same, by adding a line to web.config file and i dont remember tht. sorry.
    no change i didnt see any thing still same problem persists.
    Pl : I'm a professional php developer turned asp.net developer now, learning n working c#.
    Many Thanks..
    PHP Professional turned ASP.NET Professional

  4. #4
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,629
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Also, it could be a trust issue. Apps running in medium trust (which is what most web hosts use) can't go "up the tree" so to speak, meaning they cannot access folders outside the application's root directory. Solution here is to stuff everything that you want accessible to the app, but not to direct http requests, into App_Data.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •