Directory.Exists没有映射目录 [英] Directory.Exists not getting mapped directory

查看:165
本文介绍了Directory.Exists没有映射目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将目录从另一台机器映射到我的机器,如 Z:驱动器。这进一步映射到我的本地 IIS7 上的虚拟目录中。在我的一个页面上,我使用 Server.MapPath(〜/ dira / mapped_dir)它正在给我正确的路径,如: Z:\\ \\\somedir\\mapped_dir 。我可以打开这个目录并读取文件。但是在ASPX页面中,我执行 System.IO.Directory.Exists(Z:\\\somedir\\\mapped_dir)它返回 false 即可。

I have mapped a directory from another machine to my machine as Z: drive. This is further mapped inside a virtual directory on my local IIS7. On one of my pages I am using Server.MapPath("~/dira/mapped_dir") it is giving me correct path like: Z:\\somedir\\mapped_dir. I am able to open this directory and read-write files into it. But when in the ASPX page I execute System.IO.Directory.Exists("Z:\\somedir\\mapped_dir") it returns false.

这是否具有任何权限或还有其他问题?源机器(包含物理文件夹)给共享文件夹上的所有用户提供了读写访问。

Does this have anything with permissions or there is some other issue?. The source machine (which contains the physical folder) has given read-write access to all users on the shared folder.

推荐答案

知道使用用于虚拟目录的SUBST命令是每个用户设置,并且不与作为不同用户(例如服务)运行的代码一起使用。听起来像它可能类似于你的问题...

I know that using the SUBST command for virtual directories is a per-user setting and doesn't work with code running as a different user (e.g. a service). Sounds like it might be similar to your problems...

这篇关于Directory.Exists没有映射目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆