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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why does system.io.directory.exists() sometimes fail over lan?

Status
Not open for further replies.

silverspecv

Programmer
Oct 31, 2003
125
US
I have code that checks to make sure a certain share is on the network before doing some stuff, so I have a block that includes this:

Code:
Dim dir1 As System.IO.Directory
if dir1.Exists("\\server\share") then blahblah()

It works in the IDE, and it sometimes works from the compiled and installed application, but sometimes it fails for seemingly no good reason. It will popup the failure message box saying "\\blah blah can't be reached" etc, but I click start->run and type in the UNC and it pops right up.. I even stored the server share name in a string and used that string in the exists() as well as the msgbox() to make sure I'm comparing apples to apples, and I just can't figure it out.. Any idea why it is so hit-or-miss??
 
might just be a poor network connection issue, dropped packets and timeouts. You may want to put the block in a 3 attempt loop (on success, exit the loop, and after 3 attempts throw an exception).

-Rick

VB.Net Forum forum796 forum855 ASP.NET Forum
[monkey]I believe in killer coding ninja monkeys.[monkey]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top