0

My Server Machine includes:

  1. IIS 7.
  2. Window server 2008.
  3. Network Drive mapped as Z drive which is of Linux machine.
  4. ASP.NET MVC 3 application hosted on server machine.

Problems:

I have built asp.net mvc 3 application that can upload the mulitiple file to local drive but is not able to upload to network drive (Z:/ in my case) of my server machine. It shows error:

Could not find a part of the path 'Z:\uploadfolder\sdlkfjsdl.wav'.

Then, I have checked the folder (uploadfoler) security option where the Network service user doesn't have permission for full control or write permission. The problem here is that I have no rights to add permission for NETWORK SERVICE User and network drive belongs to LINUX manchine.

While Searching for alternate solution, I found concept called impersonate. I am completely new to this concept. Is this able to solve my problem in my scenario? Or, Is there any other alternative solution?

CodeManiac
  • 974
  • 8
  • 34
  • 56

2 Answers2

1

Your application should run in a separate IIS application pool. In IIS you can assign a user to the app pool. This user should have write access to the network driver.

See http://technet.microsoft.com/en-us/library/cc753842(v=ws.10).aspx

Richard Schneider
  • 34,944
  • 9
  • 57
  • 73
  • how can I add user to app pool which have access to network drive in IIS – CodeManiac Jan 16 '13 at 11:18
  • I have Everyone User that have full control access to folder of Mapped Network Drive. Can I add that user to APP POOL – CodeManiac Jan 16 '13 at 11:43
  • 2
    No, the Everyone user won't work and I certainly wouldn't run an application pool as the Everyone user (that's a group anyway, right?). Create an account specifically for this (assuming you have an Active Directory domain in place). – Jared Peless Jan 29 '13 at 02:47
0

OK, Z:\ is your network drive, but is it located on the machine hosting IIS without any mapping of network drives? If it is on another machine you need to use UNC paths (i.e. \server\path\folder\filename.ext) because the user IIS is running under won't have it mapped.

You won't "add" a user to the application pool... you will create an explicit application pool that runs as a named user instead of Network Service or Application Pool Identity. When creating an application pool you may specify the user that it runs as. You can find plenty of information on this for your specific version of IIS.

This named user is who will need permission to write/read to the UNC path you configure.

Jared Peless
  • 1,120
  • 9
  • 11
  • I have use UNC Path (\\11.01.55.11\uploadfolder\) and shows error while uploading: The network name cannot be found. – CodeManiac Jan 16 '13 at 12:20
  • while using UNC path, it show error: Access to the path '\\101.45.89.10\sharefolder\uploadfolder\3121N_nextjokes.wav' is denied. – CodeManiac Jan 16 '13 at 13:13
  • You need to have sufficient write privileges for the user the process is executing as... if you are using Network Service then it is using the machine name user for access (i.e. MACHINENAME$) but I would configure the application pool to use a specific NT user account (like an account configured as a service account) and provide privileges to that account. – Jared Peless Jan 29 '13 at 02:45