Fletcher,

        I assume since you're in vista that you are running VS with elevated
privileges (run as admin). This means that when you start the debugger in
the ide you are not running in the logged in users account anymore, you are
in the admin account. The easiest way to fix this for debugging is to start
the cmd prompt with admin privs (right click and run as admin) then use the
net use k: \\servername\map command to map the drive as admin.

The compiled app will run fine since it is running in the users account.

HTH,
Rob

-----Original Message-----
From: Discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] On Behalf Of Fletcher
Sent: Thursday, July 12, 2007 8:21 PM
To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM
Subject: [ADVANCED-DOTNET] FW: Verifying existence of mapped drives - why
doesn't it work?

Hi all,

Here is some basic code:
   ....
   For Each drive As String In System.IO.Directory.GetLogicalDrives()
       Debug.WriteLine(drive)
   Next ' drive

   Debug.WriteLine(System.IO.Directory.Exists("k:\"))
   ...

This code could just as easily been written in C#.  In any case, if I bring
up explorer, I have the following mapped drive:

backup (\\fletcher)(K:)

I can click on the mapping and see the folders located therein.  But, if I
run the code above, it only shows me drives C: and D:.  And the last command
returns FALSE.  I can copy files to K:\Backup\ with no problem at all using
Explorer.  But .NET is positive that I do NOT have any other drives.

My guess is that there is a setting somewhere that needs to be changed to
tell .NET to include mapped drives when using the IO.Directory classes.  Any
ideas?

BTW, using:
 Microsoft Visual Basic 2005 - 77718-007-4009332-41823  Vista Ultimate with
latest patches.

Thanks,

Fletcher

===================================
This list is hosted by DevelopMentor.  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to