Upload Permissions

Discussion in 'ASP .Net' started by Wayne Wengert, Oct 26, 2005.

  1. I am trying to execute a file upload of a file but I ghet the error shown
    below. I do have MyMachine\ASPNET permission set but I am using IIS6 and
    the error information indicates that the base process identity is "Network
    Service" in that case but I cannot find any such identity? How can I grand
    the necessary access?

    Wayne

    ============================================================
    Exception Details: System.UnauthorizedAccessException: Access to the path
    "C:\Banner.NET\images\banners\xtb_banner.swf" 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 write 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.
     
    Wayne Wengert, Oct 26, 2005
    #1
    1. Advertising

  2. Wayne Wengert

    Niraj Ranka Guest

    Hello,

    Which Operating system u r using?
    Also u will get the Network Services in it... try to search out using
    advanced option.
    --
    Niraj Ranka
    The will to be successfull is waste, unless u have the will to prepare!!!

    "Wayne Wengert" <> wrote in message
    news:...
    >I am trying to execute a file upload of a file but I ghet the error shown
    >below. I do have MyMachine\ASPNET permission set but I am using IIS6 and
    >the error information indicates that the base process identity is "Network
    >Service" in that case but I cannot find any such identity? How can I grand
    >the necessary access?
    >
    > Wayne
    >
    > ============================================================
    > Exception Details: System.UnauthorizedAccessException: Access to the path
    > "C:\Banner.NET\images\banners\xtb_banner.swf" 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 write 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.
    >
    >
     
    Niraj Ranka, Oct 26, 2005
    #2
    1. Advertising

  3. I am running on WinXP Pro

    Wayne

    "Niraj Ranka" <> wrote in message
    news:...
    > Hello,
    >
    > Which Operating system u r using?
    > Also u will get the Network Services in it... try to search out using
    > advanced option.
    > --
    > Niraj Ranka
    > The will to be successfull is waste, unless u have the will to prepare!!!
    >
    > "Wayne Wengert" <> wrote in message
    > news:...
    >>I am trying to execute a file upload of a file but I ghet the error shown
    >>below. I do have MyMachine\ASPNET permission set but I am using IIS6 and
    >>the error information indicates that the base process identity is "Network
    >>Service" in that case but I cannot find any such identity? How can I grand
    >>the necessary access?
    >>
    >> Wayne
    >>
    >> ============================================================
    >> Exception Details: System.UnauthorizedAccessException: Access to the path
    >> "C:\Banner.NET\images\banners\xtb_banner.swf" 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 write 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.
    >>
    >>

    >
    >
     
    Wayne Wengert, Oct 26, 2005
    #3
  4. Wayne Wengert

    dimpy Guest

    I am not 100% sure but whenever I have such access problems I insert
    the line <identity impersonate="true"/> in my project's web.config
    file. Try doing that and see if it works.

    Regards,
    Dimpy
     
    dimpy, Oct 27, 2005
    #4
  5. Interesting - I'll give it a try

    Wayne

    "dimpy" <> wrote in message
    news:...
    >I am not 100% sure but whenever I have such access problems I insert
    > the line <identity impersonate="true"/> in my project's web.config
    > file. Try doing that and see if it works.
    >
    > Regards,
    > Dimpy
    >
     
    Wayne Wengert, Oct 27, 2005
    #5
  6. Where in the Web.Config file do you put that?

    Wayne

    "dimpy" <> wrote in message
    news:...
    >I am not 100% sure but whenever I have such access problems I insert
    > the line <identity impersonate="true"/> in my project's web.config
    > file. Try doing that and see if it works.
    >
    > Regards,
    > Dimpy
    >
     
    Wayne Wengert, Oct 27, 2005
    #6
  7. Anywhere inside the <system.web> section.

    A warning : while that might certainly solve your problem,
    it may bring on other, less obvious, problems, too, like
    an account which you don't know having access permissions
    to a lot of directories.

    What you really should do is detect the account ASP.NET is running as,
    and give *that* account the necessary permissions, instead of impersonating
    an account which might be a security risk.

    Save the following as identity.aspx and run it.

    identity.aspx
    -------------------
    <%@ Page Language="VB" %>
    <%@ Import NameSpace = System.Security.Principal %>
    <script runat="server">
    Sub Page_Load()
    Dim tmp As String = WindowsIdentity.GetCurrent.Name()
    Label1.Text = tmp
    End Sub
    </script>
    <html>
    <head>
    <title>WindowsIdentity.GetCurrent.Name()</title>
    </head>
    <body>
    <form id="form1" runat="server">
    <div>
    <asp:Label ID="Label1" Runat="server" Text="Label"></asp:Label>
    </div>
    </form>
    </body>
    </html>
    ------------------

    When you run that file, it will return the current ASP.NET identity,
    i.e., the account ASP.NET is running as.

    Give *that* account the permissions you need,
    instead of blindly impersonating an unknown account.




    Juan T. Llibre, ASP.NET MVP
    ASP.NET FAQ : http://asp.net.do/faq/
    Foros de ASP.NET en EspaƱol : http://asp.net.do/foros/
    ======================================
    "Wayne Wengert" <> wrote in message
    news:...
    > Where in the Web.Config file do you put that?
    >
    > Wayne
    >
    > "dimpy" <> wrote in message
    > news:...
    >>I am not 100% sure but whenever I have such access problems I insert
    >> the line <identity impersonate="true"/> in my project's web.config
    >> file. Try doing that and see if it works.
    >>
    >> Regards,
    >> Dimpy
    >>

    >
    >
     
    Juan T. Llibre, Oct 27, 2005
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark

    File upload permissions

    Mark, Nov 12, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    553
    Suresh
    Nov 12, 2003
  2. Andrea Williams

    Need help with File Upload Permissions

    Andrea Williams, Jul 9, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    1,948
    Andrea Williams
    Jul 9, 2004
  3. Scott Allen
    Replies:
    0
    Views:
    462
    Scott Allen
    Jul 13, 2004
  4. Jay

    File Upload Permissions

    Jay, Apr 4, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    525
    Steve C. Orr [MVP, MCSD]
    Apr 4, 2005
  5. Curt K
    Replies:
    0
    Views:
    584
    Curt K
    Nov 3, 2006
Loading...

Share This Page