开发者

File.GetAttributes(unc) generating "Network path not found" error

开发者 https://www.devze.com 2023-04-03 10:38 出处:网络
I\'m passing a UNC path to File.GetAttributes().This works fine when running off my local, but when I move the site to the t开发者_Python百科est server, I get a \"Network path not found\" error.I am a

I'm passing a UNC path to File.GetAttributes(). This works fine when running off my local, but when I move the site to the t开发者_Python百科est server, I get a "Network path not found" error. I am able to navigate to the path from the test server, so I don't know why I would be getting this error. The code is very simple. This is where it errors out:

try
{
    if (FileAttributes.Directory != (FileAttributes.Directory & File.GetAttributes(directory)))
        directory = GetPath(directory);
}
catch...


Being able to navigate to the share from the server doesn't mean much - remember your application is running under another account, usually whatever the app pool is set to. That account normally does not have access to anything other than the resources in the local machine, because it's not a domain account.

Check what account the app pool is running under. You might have to change that to a domain account on your AD forest to be able to access things on other servers.


Most likely it is "NTLM one hop" issue - credentials of a remote user can't be passed to thrird server.

Machine 1:Browser -(credentials)-> Machine 2:ASP.Net site -(no credentials)-> Machine 3.

Solution is to access "machine 3" under known (i.e. process) account or use Kerberos.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号