FileNotFoundException

Discussion in 'ASP .Net' started by Luigi, Sep 20, 2006.

  1. Luigi

    Luigi Guest

    Hi all,
    I have a problem with my asp.net application.
    I can't read a file that is on another server (10.1.8.15), while my
    application in on 10.1.8.14.
    In that file I have a shared folder, within the file "txt".
    I've used the following code:

    bool present;
    FileInfo f1 = new FileInfo(@"\\10.1.8.15\CDG\CDG_CD.txt");
    if (f1.Exists)
    { present = true; }
    else
    {lblError.Text += ". Missing file " + f1.ToString();}

    but always says me that the file does not exist
    (FileNotFoundExcpetion).
    If I run the command \\10.1.8.15\CDG\CDG_CD.txt from Start - Run, I can
    see the file.
    What's the problem?

    Thanks a lot.

    Luigi
    Luigi, Sep 20, 2006
    #1
    1. Advertising

  2. by default the asp.net account does not have network access. change the
    account to a domin account. if you ar on 2003 set the app pool identity to a
    domain account with access to the share.

    -- bruce (sqlwork.com)

    "Luigi" <> wrote in message
    news:...
    > Hi all,
    > I have a problem with my asp.net application.
    > I can't read a file that is on another server (10.1.8.15), while my
    > application in on 10.1.8.14.
    > In that file I have a shared folder, within the file "txt".
    > I've used the following code:
    >
    > bool present;
    > FileInfo f1 = new FileInfo(@"\\10.1.8.15\CDG\CDG_CD.txt");
    > if (f1.Exists)
    > { present = true; }
    > else
    > {lblError.Text += ". Missing file " + f1.ToString();}
    >
    > but always says me that the file does not exist
    > (FileNotFoundExcpetion).
    > If I run the command \\10.1.8.15\CDG\CDG_CD.txt from Start - Run, I can
    > see the file.
    > What's the problem?
    >
    > Thanks a lot.
    >
    > Luigi
    >
    bruce barker \(sqlwork.com\), Sep 20, 2006
    #2
    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. Brian
    Replies:
    1
    Views:
    3,247
    Rick Strahl [MVP]
    Dec 5, 2003
  2. Stephen Witter
    Replies:
    2
    Views:
    5,444
    Stephen Witter
    May 28, 2004
  3. msnews.microsoft.com

    System.IO.FileNotFoundException help

    msnews.microsoft.com, Jun 3, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    2,202
    msnews.microsoft.com
    Jun 3, 2004
  4. Martinh
    Replies:
    0
    Views:
    2,771
    Martinh
    Aug 15, 2004
  5. =?Utf-8?B?UmFqYQ==?=
    Replies:
    2
    Views:
    815
    bruce barker
    Sep 24, 2004
Loading...

Share This Page