如何以编程方式检查/设置网络驱动器的访问权限?
如何检查您是否有权访问网络驱动器(但是 - 因为在您在此 Windows 会话中至少导航一次并输入名称/密码之后,它会正常工作)网络驱动器,而无需在尝试访问时等待 IOException它?
在这一点上,假设我可以通过对话框获取我的用户名/密码,我如何设置他们对该网络文件夹的访问权限?
How do you check to see if you have access (yet - because it will work fine after you have navigated there at least once before in this windows session and entered name/pass) to a network drive without waiting for the IOException when trying to access it?
And on that note, suppose that I can get my users name/pass via dialog, how do I set their access permissions to that network folder?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一般来说,我认为最好只处理异常。 在检查和尝试访问驱动器之间,您无法 100% 肯定您具有访问权限。 更不用说可能发生的所有其他错误。
In general, I think it is better to just handle the exception instead. You can't be 100% positive that you have access between checking and trying to access a drive. Not to mention all the other errors that could happen.