Could not find a part of the path

Discussion in 'ASP .Net Web Services' started by Matías, Mar 14, 2006.

  1. Matías

    Matías Guest

    I have two servers with windows 2003.

    I have an app running under server 1 (asp 1.1) and I try to write files in
    the server 2.

    In the server 2, I have a full access to the directory, but I have the error
    Could not find a part of the path

    Thenks in advance
     
    Matías, Mar 14, 2006
    #1
    1. Advertising

  2. Hello Matías,

    show your code

    M> I have two servers with windows 2003.
    M>
    M> I have an app running under server 1 (asp 1.1) and I try to write
    M> files in the server 2.
    M>
    M> In the server 2, I have a full access to the directory, but I have
    M> the error Could not find a part of the path
    M>
    M> Thenks in advance
    M>
    ---
    WBR,
    Michael Nemtsev :: blog: http://spaces.msn.com/laflour

    "At times one remains faithful to a cause only because its opponents do not
    cease to be insipid." (c) Friedrich Nietzsche
     
    Michael Nemtsev, Mar 14, 2006
    #2
    1. Advertising

  3. Matías

    Matías Guest

    Hi, the code is:

    ruta = "\\hpr2k01\XML-Menu"

    string direct = ruta + "/" +
    String.Format("{0}_{1}",DateTime.Now.Minute.ToString(),DateTime.Now.Millisecond.ToString());
    string FILENAME = direct + "/" +
    String.Format("{0}_{1}.txt",DateTime.Now.Minute.ToString(),DateTime.Now.Second.ToString());


    if(!Directory.Exists(direct))

    Directory.CreateDirectory(direct);


    //Get a StreamReader class that can be used to read the file

    StreamWriter objStreamWriter;

    objStreamWriter = File.AppendText(FILENAME);

    //Now, read the entire file into a string

    objStreamWriter.WriteLine("A user viewed this demo at: " +
    DateTime.Now.ToString());

    objStreamWriter.WriteLine(System.Configuration.ConfigurationSettings.AppSettings.Get("path-estilos"));

    //Close the stream

    objStreamWriter.Close();



    "Michael Nemtsev" <> escribió en el mensaje
    news:...
    > Hello Matías,
    >
    > show your code
    >
    > M> I have two servers with windows 2003.
    > M> M> I have an app running under server 1 (asp 1.1) and I try to write
    > M> files in the server 2.
    > M> M> In the server 2, I have a full access to the directory, but I have
    > M> the error Could not find a part of the path
    > M> M> Thenks in advance
    > M> ---
    > WBR,
    > Michael Nemtsev :: blog: http://spaces.msn.com/laflour
    >
    > "At times one remains faithful to a cause only because its opponents do
    > not cease to be insipid." (c) Friedrich Nietzsche
    >
    >
     
    Matías, Mar 14, 2006
    #3
  4. Hello Matías,

    use @ sign before path: ruta = @"\\hpr2k01\XML-Menu"

    BTW, I can't see the error besides this one. It works fine. Check your permisions,
    and try to create file in network folder manually

    M> Hi, the code is:
    M>
    M> ruta = "\\hpr2k01\XML-Menu"
    M>
    M> string direct = ruta + "/" +
    M> String.Format("{0}_{1}",DateTime.Now.Minute.ToString(),DateTime.Now.M
    M> illisecond.ToString()); string FILENAME = direct + "/" +
    M> String.Format("{0}_{1}.txt",DateTime.Now.Minute.ToString(),DateTime.N
    M> ow.Second.ToString());
    M>
    M> if(!Directory.Exists(direct))
    M>
    M> Directory.CreateDirectory(direct);
    M>
    M> //Get a StreamReader class that can be used to read the file
    M>
    M> StreamWriter objStreamWriter;
    M>
    M> objStreamWriter = File.AppendText(FILENAME);
    M>
    M> //Now, read the entire file into a string
    M>
    M> objStreamWriter.WriteLine("A user viewed this demo at: " +
    M> DateTime.Now.ToString());
    M>
    M> objStreamWriter.WriteLine(System.Configuration.ConfigurationSettings.
    M> AppSettings.Get("path-estilos"));
    M>
    M> //Close the stream
    M>
    M> objStreamWriter.Close();
    M>
    M> "Michael Nemtsev" <> escribió en el mensaje
    M> news:...
    M>
    >> Hello Matías,
    >>
    >> show your code
    >>
    >> M> I have two servers with windows 2003.
    >> M> M> I have an app running under server 1 (asp 1.1) and I try to
    >> write
    >> M> files in the server 2.
    >> M> M> In the server 2, I have a full access to the directory, but I
    >> have
    >> M> the error Could not find a part of the path
    >> M> M> Thenks in advance
    >> M> ---
    >> WBR,
    >> Michael Nemtsev :: blog: http://spaces.msn.com/laflour
    >> "At times one remains faithful to a cause only because its opponents
    >> do not cease to be insipid." (c) Friedrich Nietzsche
    >>

    ---
    WBR,
    Michael Nemtsev :: blog: http://spaces.msn.com/laflour

    "At times one remains faithful to a cause only because its opponents do not
    cease to be insipid." (c) Friedrich Nietzsche
     
    Michael Nemtsev, Mar 14, 2006
    #4
  5. Matías

    Matías Guest

    I found the solution to "Could not find a part of the path":

    In both servers I create a normal user with the same username and password.

    in the web.config of the app in the first server I use
    <system.web>
    <identity impersonate="true" userName="(name)" password="(pass)" />
    </system.web>

    In the folder of the second server I shared the folder and I gave full
    permitions to the user created and to the allusers I gave only read
    permitions.

    In the options security of the folder I gave full permitions to the new user

    Thanks for all


    "Michael Nemtsev" <> escribió en el mensaje
    news:...
    > Hello Matías,
    >
    > use @ sign before path: ruta = @"\\hpr2k01\XML-Menu"
    >
    > BTW, I can't see the error besides this one. It works fine. Check your
    > permisions, and try to create file in network folder manually
    >
    > M> Hi, the code is:
    > M> M> ruta = "\\hpr2k01\XML-Menu"
    > M> M> string direct = ruta + "/" +
    > M> String.Format("{0}_{1}",DateTime.Now.Minute.ToString(),DateTime.Now.M
    > M> illisecond.ToString()); string FILENAME = direct + "/" +
    > M> String.Format("{0}_{1}.txt",DateTime.Now.Minute.ToString(),DateTime.N
    > M> ow.Second.ToString());
    > M> M> if(!Directory.Exists(direct))
    > M> M> Directory.CreateDirectory(direct);
    > M> M> //Get a StreamReader class that can be used to read the file
    > M> M> StreamWriter objStreamWriter;
    > M> M> objStreamWriter = File.AppendText(FILENAME);
    > M> M> //Now, read the entire file into a string
    > M> M> objStreamWriter.WriteLine("A user viewed this demo at: " +
    > M> DateTime.Now.ToString());
    > M> M>
    > objStreamWriter.WriteLine(System.Configuration.ConfigurationSettings.
    > M> AppSettings.Get("path-estilos"));
    > M> M> //Close the stream
    > M> M> objStreamWriter.Close();
    > M> M> "Michael Nemtsev" <> escribió en el mensaje
    > M> news:...
    > M>
    >>> Hello Matías,
    >>>
    >>> show your code
    >>>
    >>> M> I have two servers with windows 2003.
    >>> M> M> I have an app running under server 1 (asp 1.1) and I try to
    >>> write
    >>> M> files in the server 2.
    >>> M> M> In the server 2, I have a full access to the directory, but I
    >>> have
    >>> M> the error Could not find a part of the path
    >>> M> M> Thenks in advance
    >>> M> ---
    >>> WBR,
    >>> Michael Nemtsev :: blog: http://spaces.msn.com/laflour
    >>> "At times one remains faithful to a cause only because its opponents
    >>> do not cease to be insipid." (c) Friedrich Nietzsche
    >>>

    > ---
    > WBR,
    > Michael Nemtsev :: blog: http://spaces.msn.com/laflour
    >
    > "At times one remains faithful to a cause only because its opponents do
    > not cease to be insipid." (c) Friedrich Nietzsche
    >
    >
     
    Matías, Mar 15, 2006
    #5
  6. Matías

    Winista Guest

    How are you specifying the path?

    --
    Netomatix
    http://www.netomatix.com
    "Matías" <> wrote in message
    news:...
    >I have two servers with windows 2003.
    >
    > I have an app running under server 1 (asp 1.1) and I try to write files in
    > the server 2.
    >
    > In the server 2, I have a full access to the directory, but I have the
    > error Could not find a part of the path
    >
    > Thenks in advance
    >
     
    Winista, Mar 15, 2006
    #6
    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. dsh
    Replies:
    0
    Views:
    479
  2. Tom Vogel
    Replies:
    5
    Views:
    8,584
    Dmitry Kulakovsky
    Aug 30, 2004
  3. TC
    Replies:
    3
    Views:
    26,284
    jessica
    May 19, 2004
  4. jessica
    Replies:
    0
    Views:
    1,879
    jessica
    May 20, 2004
  5. Phil Winstanley [Microsoft MVP ASP.NET]

    Re: Error: Could not find a part of the path

    Phil Winstanley [Microsoft MVP ASP.NET], May 21, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    391
    Phil Winstanley [Microsoft MVP ASP.NET]
    May 21, 2004
Loading...

Share This Page