Azure file storage/indexing solution - asp.net-mvc

I'm developing a Web Application, and it is running as an Azure Web App. This application has a section in which a user can navigate a directory, and allows the user to open the files and browse sub-directories in said directory.
At the moment, the sub-directories and files are inside "~/Content/Documents", and I am browsing the directory's by using Directory.GetFiles() and Directory.GetDirectories(); functions which are provided by System.IO.
The files in question would be retrieved and downloaded several times a day, and there is no way to manually path one-by-one, seeing as there is a large quantity, and they are subject to change.
However, I has become inconvenient to store the files within the web directory. So my two questions are:
What Azure service can I use to store and retrieve my files?
and
Which of these services provides the ability to index/map a path, which would fit with my web-app?
Please note that the users do not have the ability to edit or otherwise upload any of the files, and there is therefor no need for the service to allow non-authenticated upload.

The newish Azure File Storage feature can be used to store files in Azure Storage and make them accessible via an SMB file share. This will allow for legacy application that require the use of a traditional file share for saving / retrieving files. This allows for easier integration into existing applications without needing to completely rewrite the file storage code.
https://azure.microsoft.com/en-us/blog/azure-file-storage-now-generally-available/

Related

How to access files on Ceph directly as URL

I need a storage system with the following requirements:
1. It should support data/service clustering
2. It should be open-source so that I can extend functionalities later if needed
3. It should support file system because I want to access some files as public url(direct access). So that I can store my scripts in these files and directly refer these files.
4. Supports some kind of authentication
5. I want it to be on premise (Not cloud).
Ceph seems to qualify all the criteria but does it support the public access of files just like a URL(Point 3) ? It has ability to generate temporary URLs though but I want permanent URLs for few files.
You could run Nextcloud and have your data volume (and database, if you feel so inclined) stored on the Ceph cluster. That's open-source, you can setup direct links to files including permanent links, and is authenticated.

Where does Moodle store the files that users upload for their assignments?

Imagine that a user uploads a file called "myAssignment.docx" to Moodle to complete the submission of an assignment. Where would the folder containing "myAssignment.docx" be? Is it in the moodledata folder outside the public web directory or somewhere else? I am trying to locate that folder because I want to monitor its growth to determine when I should upgrade my web hosting service to provide more storage space for files that students upload to the server.
https://docs.moodle.org/dev/File_API_internals#File_storage_on_disk
The simple answer is inside:
$CFG->dataroot.'/filedir'
It is stored in /repository directory from Ver 3.62.
You may have subdirectories. Check which one is used for the purpose.

How to share files between multiple ASP.NET MVC Applications?

I have two web application in my solution. One of them is for managing the system and another is for clients.
I should publish them one by one in separated places (of course on a machine but in separated addresses for Example http://manager.com and http://clients.com)
My question here is that, can clients web application access the files that the other manager web application has (in its physical directory)? If not how can I approach this problem?
see this design to get more details for this problem :
Thanks!
What I usually do in a scenario like this, is store the files in a folder in the application that does the writing. Then I use IIS to create a virtual directory in the other application that points to the folder containing the files in the first application.
So in your case, you could have a folder "Files" in the manager.com website. Let's say the folder has this full path: D:\Websites\manager.com\Files You can then create a virtual directory in the clients.com website pointing to that path.
This has the advantage that you can code everything as if the folder exists in both applications.
If your applications placed on one machine - certainly can.
You should do only one thing - give permission to folder with files (Or permission to DB with files) to user that run your web application on web server (Usually IIS if you use MVC < 5)
It seems from your comment that you want to share uploaded files between multiple web project. You can store them in a common folder outside your web project folder.
For example, create a folder in
"C:\Temp\" say "SharedFiles".
The manager web application that receives the file from user (through upload) can store the files in this folder. The client web application can refer this location for file while reading.
You may have to give permission to the user (IIS_IUSRS) to access this folder.

ASP.Net MVC Bundle linked content files

I've been trying to reduce the amount of copying and pasting of content files across some of my projects and decided to go down the adding files as links from a central project.
The problem I have now is that the System.Web.Optimization.Bundle.AddFile(string virtualPath, bool throwIfNotExist = true) does not work as the file doesn't really exist in the directory I specified.
Does anyone have any pointers? Or maybe an alternative to linking content files?
Thanks.
I think you cannot access files outside of your web project with the virtual path system and It might hurt when you want to deploy your app.
I suggest to make a custom project for your static content with a custom domain: e.g. static.yourcompany.com and reference all this files from this domain. This also has the advantage that the browser does not have to add the cookies for authentication and tracking to these requests, which might be faster if you have a lot of traffic. You can also open your custom cdn (http://www.maxcdn.com/pricing/) or store the files in azure or amazon aws (which is more or less free for less files and traffic).
Another approach is to make some batch files to keep your content files synced.

How to store per-user temporary files?

I need to store some temporary files from my program sometimes, currently I use the AppData path which works. However, I have just been trying my program on a non Admin (guest) account on Windows. This is resulting in errors because Windows is refusing me access to the AppData folder.
What would be the most ideal path to use instead of AppData, that even a user with the lowest permissions can use?
I tried Googling this one because I am sure I have seen an article on the Microsoft website that lists the different paths and requirements needed but I can't find it.
Thanks
If you want to store temporary files then use a sub-folder in the temporary directory. Use GetTempPath to find out where this is.
Note that on all modern versions of Windows, this folder is a per-user folder and is not shared between different users. If you want a location that is shared between all users then you need the CSIDL_COMMON_APPDATA folder. However, as you have discovered, standard users do not have rights to write in the folder. The standard approach is for the installation program to create a sub-folder with a permissive ACL that allows sufficient write access for standard users.

Resources