Mapped network drives cannot be listed in C#

前端 未结 2 796
眼角桃花
眼角桃花 2020-12-17 21:24

I am trying to list all local drives in my application, and DriveInfo.GetDrives give back the local drive letters, and I need the mapped drives too.

Cur

2条回答
  •  醉话见心
    2020-12-17 22:05

    Environment.GetLogicalDrives() and DriveInfo.GetDrives() both returned all my networked drives.

    Is your application running as a different user (For example an asp.net website)? If it is, are the drives actually mapped for that user? You might find that the drives are mapped for you but they aren't actually mapped for the user your application is running as.

提交回复
热议问题