Directory.Exists

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Phil Barber

    Directory.Exists

    using ASP.NET 1.1

    int PID=(int)Sessio n["PID"];
    string FilePath=PF.Get ProjectPath(PID );
    if(!Directory.E xists(FilePath) )
    Directory.Creat eDirectory(File Path);

    the Directory.Exist s always returns false even though the Directory does in
    fact exist.
    note the FilePath string is a UNC path ( @"\\ServerName\ ..\)
    any ideas would be welcome.
    the really strange thing is if the directory really does not exist this code
    will sucessfully create the directory, so I do not beleive it is a security
    issue
    Thanks
    phil


  • Willy Denoyette [MVP]

    #2
    Re: Directory.Exist s


    "Phil Barber" <phil_barber@aj g.com> wrote in message
    news:e6gZEqQHGH A.3984@TK2MSFTN GP14.phx.gbl...
    | using ASP.NET 1.1
    |
    | int PID=(int)Sessio n["PID"];
    | string FilePath=PF.Get ProjectPath(PID );
    | if(!Directory.E xists(FilePath) )
    | Directory.Creat eDirectory(File Path);
    |
    | the Directory.Exist s always returns false even though the Directory does
    in
    | fact exist.
    | note the FilePath string is a UNC path ( @"\\ServerName\ ..\)
    | any ideas would be welcome.
    | the really strange thing is if the directory really does not exist this
    code
    | will sucessfully create the directory, so I do not beleive it is a
    security
    | issue
    | Thanks
    | phil
    |
    |

    That's because you (the asp.net user) don't have any access rights to the
    share, note that the default account 'aspnet', doesn't even have network
    access rights. So you will have to impersonate a user with appropriate
    privileges to access the network share.

    Willy.



    Comment

    Working...