Directory.Exists not getting mapped directory

2019-09-07 04:03发布

问题:

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.

回答1:

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...