How to access UNC from ASP.NET application?

Discussion in 'ASP .Net' started by Speech Lover, Apr 19, 2007.

  1. Speech Lover

    Speech Lover Guest

    I have problem writing content to a UNC file from my ASP.NET 1.1
    application. This is on Windows server 2003
    The event log says "X:\temp\abc.txt path not found" and stuff.

    Note that I have allowed Full Control permission on abc.txt on the other
    machine.

    any idea?

    thanks,
    Vince
    Speech Lover, Apr 19, 2007
    #1
    1. Advertising

  2. re:
    > Note that I have allowed Full Control permission on abc.txt on the other machine.


    To which account have you allowed full permissions to ?
    To the ASP.NET account which is accessing the UNC file ?



    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/
    ===================================
    "Speech Lover" <> wrote in message
    news:%...
    >I have problem writing content to a UNC file from my ASP.NET 1.1 application. This is on Windows
    >server 2003
    > The event log says "X:\temp\abc.txt path not found" and stuff.
    >
    > Note that I have allowed Full Control permission on abc.txt on the other machine.
    >
    > any idea?
    >
    > thanks,
    > Vince
    >
    Juan T. Llibre, Apr 19, 2007
    #2
    1. Advertising

  3. Speech Lover

    Speech Lover Guest

    Say we have two servers: A & B.
    On B, I do
    1. Right click on C:\SharedFolder and share it out
    2. Under Sharing - Permissions, I allow Everyone to have Full Control
    3. Under Security, I adde an object Server-B\ASPNET and allow Full Control
    to it. (I wanted to allow Server-A\ASPNET but can't change the location to
    Server-A)

    Then on A, I map X: drive to Server-B\SharedFolder and have my ASP.NET code
    to write to X:\
    I also tried using \\Server-B\SharedFolder but got the same problem.

    Any comments are more than welcome

    thanks,
    Speech Lover



    "Juan T. Llibre" <> wrote in message
    news:...
    > re:
    >> Note that I have allowed Full Control permission on abc.txt on the other
    >> machine.

    >
    > To which account have you allowed full permissions to ?
    > To the ASP.NET account which is accessing the UNC file ?
    >
    >
    >
    > 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/
    > ===================================
    > "Speech Lover" <> wrote in message
    > news:%...
    >>I have problem writing content to a UNC file from my ASP.NET 1.1
    >>application. This is on Windows server 2003
    >> The event log says "X:\temp\abc.txt path not found" and stuff.
    >>
    >> Note that I have allowed Full Control permission on abc.txt on the other
    >> machine.
    >>
    >> any idea?
    >>
    >> thanks,
    >> Vince
    >>

    >
    >
    Speech Lover, Apr 19, 2007
    #3
  4. re:
    > 3. Under Security, I adde an object Server-B\ASPNET and allow Full Control to it. (I wanted to
    > allow Server-A\ASPNET but can't change the location to Server-A)


    The problem is that the account which is accessing B's C:\SharedFolder
    is the one which needs access permissions.

    If you can't grant access permissions on B's C:\SharedFolder to the A account
    which ASP.NET is running as, ASP.NET will not be able to access that resource.






    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/
    ===================================
    "Speech Lover" <> wrote in message
    news:%...
    > Say we have two servers: A & B.
    > On B, I do
    > 1. Right click on C:\SharedFolder and share it out
    > 2. Under Sharing - Permissions, I allow Everyone to have Full Control
    > 3. Under Security, I adde an object Server-B\ASPNET and allow Full Control to it. (I wanted to
    > allow Server-A\ASPNET but can't change the location to Server-A)
    >
    > Then on A, I map X: drive to Server-B\SharedFolder and have my ASP.NET code to write to X:\
    > I also tried using \\Server-B\SharedFolder but got the same problem.
    >
    > Any comments are more than welcome
    >
    > thanks,
    > Speech Lover
    >
    >
    >
    > "Juan T. Llibre" <> wrote in message
    > news:...
    >> re:
    >>> Note that I have allowed Full Control permission on abc.txt on the other machine.

    >>
    >> To which account have you allowed full permissions to ?
    >> To the ASP.NET account which is accessing the UNC file ?
    >>
    >>
    >>
    >> 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/
    >> ===================================
    >> "Speech Lover" <> wrote in message
    >> news:%...
    >>>I have problem writing content to a UNC file from my ASP.NET 1.1 application. This is on Windows
    >>>server 2003
    >>> The event log says "X:\temp\abc.txt path not found" and stuff.
    >>>
    >>> Note that I have allowed Full Control permission on abc.txt on the other machine.
    >>>
    >>> any idea?
    >>>
    >>> thanks,
    >>> Vince
    >>>

    >>
    >>

    >
    >
    Juan T. Llibre, Apr 19, 2007
    #4
  5. Speech Lover

    Speech Lover Guest

    I am just a newbie to networking.
    From Server-B, I open up Network Places and I am able to see both Server-A
    and Server-B under the same WORKGROUP.
    I click on "Locations..." but I don't see Server-A there. Nor can I click
    and browse a different location.

    Could you tell me what I need to do to allow me to select a different server
    from "Locations.."?

    Many Thanks!
    Speech Lover


    "Juan T. Llibre" <> wrote in message
    news:...
    > re:
    >> 3. Under Security, I adde an object Server-B\ASPNET and allow Full
    >> Control to it. (I wanted to allow Server-A\ASPNET but can't change the
    >> location to Server-A)

    >
    > The problem is that the account which is accessing B's C:\SharedFolder
    > is the one which needs access permissions.
    >
    > If you can't grant access permissions on B's C:\SharedFolder to the A
    > account
    > which ASP.NET is running as, ASP.NET will not be able to access that
    > resource.
    >
    >
    >
    >
    >
    >
    > 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/
    > ===================================
    > "Speech Lover" <> wrote in message
    > news:%...
    >> Say we have two servers: A & B.
    >> On B, I do
    >> 1. Right click on C:\SharedFolder and share it out
    >> 2. Under Sharing - Permissions, I allow Everyone to have Full Control
    >> 3. Under Security, I adde an object Server-B\ASPNET and allow Full
    >> Control to it. (I wanted to allow Server-A\ASPNET but can't change the
    >> location to Server-A)
    >>
    >> Then on A, I map X: drive to Server-B\SharedFolder and have my ASP.NET
    >> code to write to X:\
    >> I also tried using \\Server-B\SharedFolder but got the same problem.
    >>
    >> Any comments are more than welcome
    >>
    >> thanks,
    >> Speech Lover
    >>
    >>
    >>
    >> "Juan T. Llibre" <> wrote in message
    >> news:...
    >>> re:
    >>>> Note that I have allowed Full Control permission on abc.txt on the
    >>>> other machine.
    >>>
    >>> To which account have you allowed full permissions to ?
    >>> To the ASP.NET account which is accessing the UNC file ?
    >>>
    >>>
    >>>
    >>> 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/
    >>> ===================================
    >>> "Speech Lover" <> wrote in message
    >>> news:%...
    >>>>I have problem writing content to a UNC file from my ASP.NET 1.1
    >>>>application. This is on Windows server 2003
    >>>> The event log says "X:\temp\abc.txt path not found" and stuff.
    >>>>
    >>>> Note that I have allowed Full Control permission on abc.txt on the
    >>>> other machine.
    >>>>
    >>>> any idea?
    >>>>
    >>>> thanks,
    >>>> Vince
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >
    Speech Lover, Apr 19, 2007
    #5
  6. I suggest you use impersonation to have ASP.NET run under a different user
    account that has the necessary network access.
    At first, for testing purposes, I'd suggest you have it run under your user
    account since you know you have the required access to the folder.

    <!-- Web.config file. -->
    <identity impersonate="true" userName="Redmond\BillG" password="Melinda"/>

    --
    I hope this helps,
    Steve C. Orr,
    MCSD, MVP, CSM, ASPInsider
    http://SteveOrr.net


    "Speech Lover" <> wrote in message
    news:%...
    >I have problem writing content to a UNC file from my ASP.NET 1.1
    >application. This is on Windows server 2003
    > The event log says "X:\temp\abc.txt path not found" and stuff.
    >
    > Note that I have allowed Full Control permission on abc.txt on the other
    > machine.
    >
    > any idea?
    >
    > thanks,
    > Vince
    >
    Steve C. Orr [MCSD, MVP, CSM, ASP Insider], Apr 19, 2007
    #6
  7. Speech Lover

    Speech Lover Guest

    Hi Steve,

    Let me tell you more details:

    A small WORKGROUP has two Windows Server 2003 servers - server A & server B.
    I have installed an application on server A and by default it runs under
    the
    account "Network Service".
    This application writes files to a local directory without any problem but
    when
    I use UNC format to write files to server B, it fails.

    Note that on server B I have also granted full control permission to
    account
    "Network Service".

    What needs to be done to allow "Network Service" account to write to a
    network shared folder?

    In WORKGROUP environment, shouldn't "Network Service" account on both
    two servers take care of the authenticaion issue?

    thanks,
    Vince


    "Steve C. Orr [MCSD, MVP, CSM, ASP Insider]" <> wrote in
    message news:D...
    >I suggest you use impersonation to have ASP.NET run under a different user
    >account that has the necessary network access.
    > At first, for testing purposes, I'd suggest you have it run under your
    > user account since you know you have the required access to the folder.
    >
    > <!-- Web.config file. -->
    > <identity impersonate="true" userName="Redmond\BillG" password="Melinda"/>
    >
    > --
    > I hope this helps,
    > Steve C. Orr,
    > MCSD, MVP, CSM, ASPInsider
    > http://SteveOrr.net
    >
    >
    > "Speech Lover" <> wrote in message
    > news:%...
    >>I have problem writing content to a UNC file from my ASP.NET 1.1
    >>application. This is on Windows server 2003
    >> The event log says "X:\temp\abc.txt path not found" and stuff.
    >>
    >> Note that I have allowed Full Control permission on abc.txt on the other
    >> machine.
    >>
    >> any idea?
    >>
    >> thanks,
    >> Vince
    >>

    >
    Speech Lover, Apr 19, 2007
    #7
  8. Network Service is an account *local* to the W2K3 server.
    Its identity isn't usable by other servers.

    IOW, server A's "Network Service" account is local to Server A,
    and cannot access Server B's shared folder.

    re:
    !> In WORKGROUP environment, shouldn't "Network Service" account on both
    !> two servers take care of the authenticaion issue?

    No. They are different accounts, local to each server.

    Setup a user account on server A and, as Steve suggests,
    impersonate that user and give that account access permissions to the shared folder.

    As Steve suggested, write this entry in web.config :
    <!-- Web.config file. -->

    <identity impersonate="true" userName="ServerA\Accountname" password="pass"/>

    Here's the instructions to create the service account :
    http://msdn2.microsoft.com/en-us/library/ms998297.aspx

    To be on the safe side, verify that the following ACLs have been set on Server A:
    http://msdn2.microsoft.com/en-us/library/kwzs111e.aspx







    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/
    ===================================
    "Speech Lover" <> wrote in message
    news:...
    > Hi Steve,
    >
    > Let me tell you more details:
    >
    > A small WORKGROUP has two Windows Server 2003 servers - server A & server B.
    > I have installed an application on server A and by default it runs under the
    > account "Network Service".
    > This application writes files to a local directory without any problem but when
    > I use UNC format to write files to server B, it fails.
    >
    > Note that on server B I have also granted full control permission to account
    > "Network Service".
    >
    > What needs to be done to allow "Network Service" account to write to a
    > network shared folder?
    >
    > In WORKGROUP environment, shouldn't "Network Service" account on both
    > two servers take care of the authenticaion issue?
    >
    > thanks,
    > Vince
    >
    >
    > "Steve C. Orr [MCSD, MVP, CSM, ASP Insider]" <> wrote in message
    > news:D...
    >>I suggest you use impersonation to have ASP.NET run under a different user account that has the
    >>necessary network access.
    >> At first, for testing purposes, I'd suggest you have it run under your user account since you
    >> know you have the required access to the folder.
    >>
    >> <!-- Web.config file. -->
    >> <identity impersonate="true" userName="Redmond\BillG" password="Melinda"/>
    >>
    >> --
    >> I hope this helps,
    >> Steve C. Orr,
    >> MCSD, MVP, CSM, ASPInsider
    >> http://SteveOrr.net
    >>
    >>
    >> "Speech Lover" <> wrote in message
    >> news:%...
    >>>I have problem writing content to a UNC file from my ASP.NET 1.1 application. This is on Windows
    >>>server 2003
    >>> The event log says "X:\temp\abc.txt path not found" and stuff.
    >>>
    >>> Note that I have allowed Full Control permission on abc.txt on the other machine.
    >>>
    >>> any idea?
    >>>
    >>> thanks,
    >>> Vince
    >>>

    >>

    >
    >
    Juan T. Llibre, Apr 19, 2007
    #8
    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. Simon Chung-Jen Chuang
    Replies:
    1
    Views:
    3,965
    Ken Schaefer
    Aug 23, 2003
  2. =?Utf-8?B?cGpfc2VydmFkbWlu?=

    Running an asp.net application on a remote share (UNC) - parser er

    =?Utf-8?B?cGpfc2VydmFkbWlu?=, Jun 20, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    2,596
    =?Utf-8?B?cGpfc2VydmFkbWlu?=
    Jul 1, 2005
  3. mcrose
    Replies:
    0
    Views:
    353
    mcrose
    Oct 20, 2006
  4. Speech Lover

    How to access UNC from ASP.NET application?

    Speech Lover, Apr 19, 2007, in forum: ASP .Net Security
    Replies:
    1
    Views:
    130
    Dominick Baier
    Apr 19, 2007
  5. Nicopilami

    ASP.net C# - UNC shares access ... i really need help...

    Nicopilami, Apr 14, 2008, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    154
    Nicopilami
    Apr 14, 2008
Loading...

Share This Page