How to access a network share folder?

Discussion in 'ASP .Net' started by Andrew Shitov, Sep 13, 2004.

  1. I have to copy files from one network share folder to another (both are
    on different remote machines). Server running this asp.net appllication
    is not configurable (except web.config), while network forlers requires
    passwords.

    The ideal solution would allow me to simply write File.Copy (from, to,
    true).

    I thought of two possibilities: either map a network folder inside the
    asp.net application or connect to the server that contail share.

    Trying to start 'net use' failed:

    System.Diagnostics.Process.Start ("net", @"use q: \\server\share$
    /user:name password");

    After this I still have the same drives as before calling 'net use'.

    What should I do? How to map a network drive? Or how to access a server
    (not changing the machine.config)?
     
    Andrew Shitov, Sep 13, 2004
    #1
    1. Advertising

  2. Andrew Shitov

    GrantMagic Guest

    Have you tried using impersonate in the config file to make the application
    impersonate a user on the other server, there by giving you permission to
    write to the share

    "Andrew Shitov" <> wrote in message
    news:%...
    >I have to copy files from one network share folder to another (both are on
    >different remote machines). Server running this asp.net appllication is not
    >configurable (except web.config), while network forlers requires passwords.
    >
    > The ideal solution would allow me to simply write File.Copy (from, to,
    > true).
    >
    > I thought of two possibilities: either map a network folder inside the
    > asp.net application or connect to the server that contail share.
    >
    > Trying to start 'net use' failed:
    >
    > System.Diagnostics.Process.Start ("net", @"use q: \\server\share$
    > /user:name password");
    >
    > After this I still have the same drives as before calling 'net use'.
    >
    > What should I do? How to map a network drive? Or how to access a server
    > (not changing the machine.config)?
    >
     
    GrantMagic, Sep 13, 2004
    #2
    1. Advertising

  3. > Have you tried using impersonate in the config file to make the application
    > impersonate a user on the other server, there by giving you permission to
    > write to the share


    I inserted <identity impersonate="true"/> into web.config - but I have
    to somehow pass userName/password pair. If I will place

    userName="..." password="..."

    into <identity impersonate/> then an application fails to start.
     
    Andrew Shitov, Sep 13, 2004
    #3
  4. > You need to grant asp.net account special rights to run exes. If you can't
    > change anything on the server, you might want to setup remote machines that
    > host shared directories to allow access to asp.net account on the web
    > server.


    I cannot change remote machine security settings while I am able to
    congigure a machine with asp.net application. But is it possible to
    aviod modifying machine.config?

    How to grant asp.net account these rights?
     
    Andrew Shitov, Sep 13, 2004
    #4
  5. You need to grant asp.net account special rights to run exes. If you can't
    change anything on the server, you might want to setup remote machines that
    host shared directories to allow access to asp.net account on the web
    server.

    Eliyahu

    "Andrew Shitov" <> wrote in message
    news:%...
    > I have to copy files from one network share folder to another (both are
    > on different remote machines). Server running this asp.net appllication
    > is not configurable (except web.config), while network forlers requires
    > passwords.
    >
    > The ideal solution would allow me to simply write File.Copy (from, to,
    > true).
    >
    > I thought of two possibilities: either map a network folder inside the
    > asp.net application or connect to the server that contail share.
    >
    > Trying to start 'net use' failed:
    >
    > System.Diagnostics.Process.Start ("net", @"use q: \\server\share$
    > /user:name password");
    >
    > After this I still have the same drives as before calling 'net use'.
    >
    > What should I do? How to map a network drive? Or how to access a server
    > (not changing the machine.config)?
    >
     
    Eliyahu Goldin, Sep 13, 2004
    #5
  6. I am able to act as an administrator of a machine with asp.net
    application. Would you tell, how to do that?

    > What you are able to do with your application depends on what rights the
    > account your application is running under has. Granting rights to accounts
    > is a job of the system administrator. He/she does it with standard Windows
    > utilities. It can't be done from within the application.



    >>How to grant asp.net account these rights?
     
    Andrew Shitov, Sep 13, 2004
    #6
  7. Andrew Shitov

    GrantMagic Guest

    Here is exactly how i had it working in my application

    <configuration>
    <system.web>
    <identity impersonate="true" userName="DMN\UserName"
    password="password" />
    </system.web>
    </configuration>

    "Andrew Shitov" <> wrote in message
    news:...
    >> Have you tried using impersonate in the config file to make the
    >> application impersonate a user on the other server, there by giving you
    >> permission to write to the share

    >
    > I inserted <identity impersonate="true"/> into web.config - but I have to
    > somehow pass userName/password pair. If I will place
    >
    > userName="..." password="..."
    >
    > into <identity impersonate/> then an application fails to start.
    >
     
    GrantMagic, Sep 13, 2004
    #7
  8. > <configuration>
    > <system.web>
    > <identity impersonate="true" userName="DMN\UserName"
    > password="password" />
    > </system.web>
    > </configuration>


    In this case an application cannot even start:

    Parser Error Message: Could not create Windows user token from the
    credentials specified in the config file. Error from the operating
    system 'Logon failure: unknown user name or bad password. '

    An application need these userName/password only to access the remote
    server but it tries to use them even when I open an .aspx page.
     
    Andrew Shitov, Sep 13, 2004
    #8
  9. What you are able to do with your application depends on what rights the
    account your application is running under has. Granting rights to accounts
    is a job of the system administrator. He/she does it with standard Windows
    utilities. It can't be done from within the application.

    Eliyahu

    "Andrew Shitov" <> wrote in message
    news:...
    > > You need to grant asp.net account special rights to run exes. If you

    can't
    > > change anything on the server, you might want to setup remote machines

    that
    > > host shared directories to allow access to asp.net account on the web
    > > server.

    >
    > I cannot change remote machine security settings while I am able to
    > congigure a machine with asp.net application. But is it possible to
    > aviod modifying machine.config?
    >
    > How to grant asp.net account these rights?
    >
     
    Eliyahu Goldin, Sep 13, 2004
    #9
  10. Andrew Shitov

    GrantMagic Guest

    have you tried to give the user your impersonating, rights to work on the
    machine the application is running.

    I.E. create a generic user for both servers, enable it admin rights on both
    servers, and test if the application will start then?


    "Andrew Shitov" <> wrote in message
    news:...
    >> <configuration>
    >> <system.web>
    >> <identity impersonate="true" userName="DMN\UserName"
    >> password="password" />
    >> </system.web>
    >> </configuration>

    >
    > In this case an application cannot even start:
    >
    > Parser Error Message: Could not create Windows user token from the
    > credentials specified in the config file. Error from the operating system
    > 'Logon failure: unknown user name or bad password. '
    >
    > An application need these userName/password only to access the remote
    > server but it tries to use them even when I open an .aspx page.
    >
     
    GrantMagic, Sep 13, 2004
    #10
    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. Steve Roszko

    Access Network Share with ASP.NET

    Steve Roszko, Oct 22, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    813
    Steve Roszko
    Oct 22, 2003
  2. flat_ross
    Replies:
    2
    Views:
    984
    Steve C. Orr [MVP, MCSD]
    May 28, 2004
  3. =?Utf-8?B?QVNQLk5FVCBVc2Vy?=

    Running Virtual Folder on Network Share with a different user

    =?Utf-8?B?QVNQLk5FVCBVc2Vy?=, May 31, 2004, in forum: ASP .Net
    Replies:
    11
    Views:
    681
    [MSFT]
    Jul 2, 2004
  4. Saraswati lakki
    Replies:
    0
    Views:
    1,428
    Saraswati lakki
    Jan 6, 2012
  5. George
    Replies:
    1
    Views:
    202
    Robert Klemme
    Sep 15, 2009
Loading...

Share This Page