Could Not Find Part of a Path

  • Thread starter Thread starter Tom
  • Start date Start date
T

Tom

I am trying to access a file in .NET code behind using a
StreamREader:

StreamReader oTextFile = new StreamReader("\\s1
\\Dest\\123.asp");

But when I run the code, I get this error.

Could not find a part of the path "C:\fhlbcinsnp1
\Destination\100597\1622686.asp".


Note: The directory is not shared but is accessible from
the Start|Run command.

Can anyone advise??

Tom
 
Tom,

You might want to use the full path of the file you are using. The
string you have now evaluates to:

\s1\Dest\123.asp

Which means the root of the drive the file is on, then the path. It
might not be exactly what you are looking for. Also, is s1 supposed to be a
machine name, or a directory name? If it is a UNC name, then you have to
use:

"\\\\s1\\Dest\\123.asp"

or

@"\\s1\Dest\123.asp"

Hope this helps.
 
Back
Top