Asp.net FileUploader does not work when using UNC file path

Let me start by saying that I am not an expert in Windows file permissions, so there may be something very basic that I'm missing here.

I have an Asp.net FileUploader control. I have a folder on the same computer as the Asp.net application, I would like the files to download.

I want FileUploader to be able to specify files in

\\thisMachineName\UploadFolder\ 

but I always get an exception stating that access to this path is denied.

If I changed the directory, which will be

 c:\UploadFolder\ 

It works great. Alternatively, I can put the aforementioned UNC in Windows Explorer, and it really displays the directory.

Any ideas or thoughts?

- Update Note. This is a Windows 2000 server window, and the All permissions are granted in the All folder.

+4
source share
3 answers

The only thing that I always see what people do is that they cannot set permissions for this resource. To set up a shared folder, you must do the following:

1) Define the account under which you will connect to the shared folder 2) Grant access rights to the account in the file system
3) Grant this account access rights to the shared network file

No. 1, in this case usually means checking your configuration or just using the process explorer to determine which ASP.NET account is running. Lots of google info on how to do this.

No. 2 is obvious. You register on the machine where the physical disk is located, find the folder in Explorer, right-click on it and go to the security tab. We have done this several times.

No. 3, where people are messy. Yes, the work account now has rights to the local file system, but not to CONNECT to the local file system over the network. On the Security tab, go to the network sharing tab and find the Permissions button. You will use this to provide workstation accounts with a connection to a shared resource.

The second problem I saw is when people try to grant access rights on machine A to an account that exists only on machine B. This will not work at all. Both machine A and machine B must belong to a common domain that A and B trust for user authentication. Most often, enterprises running Windows use ActiveDomain to control access rights on the network.

For an ASP.NET workflow on computer B to gain access to a resource on computer A, the workflow must be performed under an account that is authenticated on the network, and not just on the local machine. Most often, you will have to create a specific account on the network and grant account rights to both machines, and then use this account to start the ASP.NET workflow for your site.

If you scratch your head, you need to learn. It's not easy. I highly recommend reading the following:

http://msdn.microsoft.com/en-us/library/ms978378.aspx

Its relatively clear and contains everything you need to know.

+3
source

You can put files in this directory, but what about a user who works in an ASP.NET process? on Windows Server 2003 (and, presumably, 2008, but I'm not sure), ASP.NET runs under the NETWORK SERVICE account, which has practically no rights, especially throughout the network. You will need to use impersonation in an ASP.NET application or configure sharing with Everyone access. For this type of scenario, I usually configure sharing with Everyone access and a firewall protecting it, so only the web server has access to the web server.

+1
source

In addition to the Answer.

I had to grant account permission: NETWORK , not a NETWORK SERVICE account.

On the security tab of the shared folder, add NETWORK as the new user and grant the necessary permissions.

0
source

All Articles