1

I have a simple C# app (it is WPF), and I am polling a network location for any new *.pdf. The app runs elevated.

The network location has been mapped to the local PC as P:\ so it is quite simple to just monitor P:\ by just doing a Directory.GetFiles("p:\", "*.pdf"). This technique works great.

However, the other day I ran into an exception: "Could not find part of the path 'P:\'" (DirectoryNotFoundException).

I noticed the drive was mapped to the PC, but when the IT guy clicked on the drive in windows explorer, it required a login and password. We were then able to view the P:\ in explorer, but my app still could not access the p:.

I had the IT guy remove the login/password and then it worked (but it could have been due to a restart too, I am not sure).

What is confusing me is that I am not aware of any moment where they 'enabled' password protection for the mapped location, so I am not sure when, why, or how it stopped working. I didn't even know it was password protected.

That leads to my very simple yes/no question: If a mapped drive is password protected in windows explorer, and a user types in the login/password so that they can get to it in explorer, is that enough such that my app does not need to login with user/pass information?

If the answer is no, then I will google the proper technique for accessing p:\ using a user/pass. But any explanation about my problem is surely appreciated.

Thanks

4

1 回答 1

1

The reason it ask for password as the current used logon into windows do not have access to that network path, so did the program run with your logon.

What you need to do is get IT guys give the account which run your App the permission to access directly so that the password protection will be transparent for you

于 2012-10-22T01:52:32.073 回答