.Net website create directory to remote server access denied

Posted by tmfkmoney on Stack Overflow See other posts from Stack Overflow or by tmfkmoney
Published on 2010-04-22T22:07:24Z Indexed on 2010/04/25 6:53 UTC
Read the original article Hit count: 357

I have a web application that creates directories. The application works fine when creating a directory on the web server, however, it does not work when it tries to create a directory on our remote fileserver.

The fileserver and the webserver are in the same domain. I have created a local user in our domain, "DOMAIN\aspnet". The local user is on both servers.

I am running my .Net app pool under the domain user. I have also tried using windows impersonate in the web.config to run under the domain user.

I have verified that the domain user has full control to the remote directory. In an effort to debug this I have also given the "everyone" full control to the remote directory.

In an effort to debug this I have also added the domain user to the administrators group.

I have a simple .net test page on the web server to test this. Through the test page I am able to read the directory on the file server and get a list of everything in it.

I am not able to upload files or to create directories on the file server.

Here's code that works:

var path = @"\\fileserver\images\";
 var di = new DirectoryInfo(path);
            foreach (var d in di.GetDirectories())
            {
                Response.Write(d.Name);
            }

Here's code that doesn't work:

 path = Path.Combine(path, "NewDirectory");
 Directory.CreateDirectory(path);

Here's the error I'm getting: Access to the path '\fileserver\images\NewDirectory' is denied.

I'm pretty stuck on this. Any ideas?

© Stack Overflow or respective owner

Related posts about remote-server

Related posts about create-directory