0

In our company we are saving project files (.doc, .pdf, .step, .zip, ...) on a public folder. Now we started using web app built with ASP MVC for project management. Now we have a need to connect each project with its folder on public folder. Here comes several problems. You can't link to folder, because all modern browsers treat public folders as local resources and therefore block the request. Then there are problems with simultaneous access to files by different users. Maybe there would be an option that the server would give users .url file with path to file.

How is this usually solved? OneDrive is not an option. Does maybe SharePoint has some capabilities like that? Is there any software that could serve files to users?

danday74
  • 52,471
  • 49
  • 232
  • 283
gtu
  • 707
  • 1
  • 10
  • 22
  • 1
    Define `serve files to users`. Is it just downloading them? Or allowing them to be edited / uploaded? Something else? – mjwills Jul 13 '17 at 13:39
  • If you are using MVC you can just return a `File()` with the MIME type and the data. That will trigger a download in the browser. This helps obfuscate your directories too, since the users would hit a predetermined route that is not 1-to-1 with your actual path. Plus this gives you an advantage to switch the underline data store to a blob storage provider at a later date without losing the urls. – maccettura Jul 13 '17 at 13:41
  • @mjwills users should be able also to edit and update files. Not so often, but there must be that option. – gtu Jul 14 '17 at 09:47

1 Answers1

2

In IIS, add a virtual directory to your site(s). Give it a name and set the path to your public folder path. Then, when you want a file from this folder, you'll use the virtual directory name instead. For example, if you created a "foo" virtual directory that maps to "\\foohost\public\foo", then your URL for a resource in that folder would be like http://foo.com/foo/resource.doc.

Chris Pratt
  • 232,153
  • 36
  • 385
  • 444
  • I will try this option on my DEV server and I will see how it goes. – gtu Jul 14 '17 at 09:48
  • This approach is not the right one. Server does not allow direct access to files, i think because my app has windows authentication. – gtu Jul 18 '17 at 08:30
  • You have to give necessary permissions to the user/service account your App Pool is running under. – Chris Pratt Jul 18 '17 at 12:54