Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Directory.Exists on a Network Share

Status
Not open for further replies.

cpope

Programmer
Jul 7, 2000
58
US
I am creating an ASP.NET application where I am going to need to write a text file in a network share folder. The problem I am experiencing is that when I try the directory exists function through an ASP.NET page it always returns false... I cut and paste the exact code into a windows forms application, and it returned true. The directory permissions are already setup to allow Everyone full access, so it is not an access issue... here is the code...

ok = Directory.Exists("//servername/folder1/folder2");
Response.Write(&quot;<BR><BR>EXISTS: &quot;+ ok);


P.S.... I have already tried reversing the direction of the slashes (which both worked in the windows forms app), and it still returned false...

If anyone has encountered and solved this problem, please respond ! :)
 
I have this code in my app for writing a temp PDF file into a directory on a local drive on the web server and it works fine. I haven't tried a nework drive though.
Code:
string sPDFTempDirPath = &quot;C:\\WebReportPDFs\\&quot;;
if(!System.IO.Directory.Exists(sPDFTempDirPath))
{
  System.IO.Directory.CreateDirectory(sPDFTempDirPath);
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top