1

I want to access files from a networkpath (\172.x.x.x\I$).The files should not be served staticly, they should only be accessisble through code.

When accessing a file directly I get an UnauthorizedAccessException: access to path denied.

What are my options here? Adding a virtual directory seems like a good idea here. But I'm stuck trying to access the virtual directory from .net core(3.1).

Timvr01
  • 476
  • 4
  • 15
  • Are you using IIS? Does the user (under which the application runs) have read permissions to the network drive? Don't confuse your local access rights with access rights from IIS. – citronas Jan 15 '20 at 13:01
  • the `\172.x.x.x\I$` shared path is accessible using evaluated permissions only. Please try to run your code as admin. However I do not think that assigning admin user permissions to the IIS app pool is a good idea (since question is tagged with `asp.net-core`) – oleksa Jan 15 '20 at 13:12
  • Yes I'm using IIS. The application user does not have read permissions. But I would prefer to use a virtual directory. Is that an option in .net core? Admin rights seems like a bad Idea for securityreasons? – Timvr01 Jan 15 '20 at 13:18
  • [Virtual directory](https://learn.microsoft.com/en-us/iis/get-started/planning-your-iis-architecture/understanding-sites-applications-and-virtual-directories-on-iis) does not allow you to read the hidden shares I suppose but please try – oleksa Jan 15 '20 at 16:02
  • [This thread](https://stackoverflow.com/questions/56772997/cant-access-to-network-share-from-application/56802141#56802141) discussed a similar issue, you can check it. – Fei Han Jan 16 '20 at 03:25

0 Answers0