0

I'm developing an ASP.NET (webforms) web application only for our intranet company. I've a network share / repository, say Z:\MyRepository\ , obviously outside c:\inetpub\wwwroot.

I need to "serve" these files from my web application.

My question is:

  1. Which permissions I need to add to Z:\MyRepository\ . IIS_USR ? Others ?

  2. How to send file ? Using Response.Transmit ?

Thanks

stighy
  • 7,260
  • 25
  • 97
  • 157
  • IIS has limited access to files by GUEST users so you need to use a Network drive? If the files are binary or contain html special characters you need to use HTTP FTP : https://learn.microsoft.com/en-us/dotnet/api/system.net.ftpwebrequest?view=netframework-4.8 – jdweng Sep 13 '19 at 13:56
  • 1. If it is a network share then adding IIS_USR will be useless as that is a machine specific group. Best bet is to use a domain user for your application pool. When you reach out across network then your application will be running in the context of that user. – Travis Acton Sep 13 '19 at 13:57
  • 2. This question already addresses a file download: https://stackoverflow.com/questions/18477398/asp-net-file-download-from-server – Travis Acton Sep 13 '19 at 13:58
  • https://blog.lextudio.com/the-most-common-technologies-not-supported-by-microsoft-8675c409bde2 Mapped drives are not supported by IIS in all cases. – Lex Li Sep 13 '19 at 20:54

1 Answers1

2

Normally the app pool user which your application is running under will be the user which needs access on the file share.

To simplify things in your application, you could also create a virtual directory in IIS and map it to the file share. This has a number of advantages, but mainly:

  • It makes it simpler to reference files from within the application.
  • If the network path changes, you only need to update your virtual directory.
  • You can also specify a different user for the virtual directory to use.
Craig H
  • 2,001
  • 1
  • 14
  • 18