Securely store pictures on share for use in web application - c#

Lets say we have photographers who use one computer in a department. They take pictures of an event then upload and organize pictures in an application. That application by default takes someone's shared location and copies pictures to that share.
On a web server there is a share we point it to. We want to make it so ONLY that application can access that share, and only THAT web application (of course, anyone with admin login to the physical server can).
Also make it so that any web browser can display the image (I believe Firefox can't take a file location of \\server\share)
Logically it would look like this:
Photographer uses an application on a public computer
Application copies images to share
Web application uses images (cross browser)
No user from public computer can access those images EDIT: the displaying on the webpage is not the problem, its how I store files in the webroot securely, so that my app can SHOW the images that are located within a shared location in a webroot. Allowing only the application on a terminal computer to access that share and NOT the user running the application from that computer. I.e. a person cant just run a command and download the entire directory contents from wherever he wants.

Wait, what? You want to show the users some pictures in a browser, but don't allow them to download them? That's impossible.

Simply configure your share's permissions (ie right click on it) to be limited to a certain windows user. Run your application under that windows user so it will have access to that share. Done!

Create a service account and run/impersonate your web and desktop applications with the
service account
Share the pictures (located on the shared drive) for the service account so that no other
user can access

Related

Asp.NET: How to send files located in a share

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:
Which permissions I need to add to Z:\MyRepository\ . IIS_USR ? Others ?
How to send file ? Using Response.Transmit ?
Thanks
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.

In Microsoft Azure i have two webapps. Form one Webapp i want to upload image that must be save in the other webapps folder

The first web app is the website and the other one is control panel .So from control panel admin upload image that must be shown in the website.
the two webapp are in the under same resource.
Look into storing the image as a Blob in Blob Storage. A storage account can be access from multiple applications.
There are several reasons you don't want to (and cannot) store it under the web app. One of them being that ...
Temporary files are not shared among site instances. Also, you cannot rely on them staying there. For instance, if you restart a web app, you'll find that all of these folders get reset to their original state.
Source: Understanding the Azure App Service file system - Temporary files

Access network folder from hosted website

I have developed one web application in c#(asp.net) and hosted in a server(say Server1). The application want the read and write access to a folder located in another server(network path) say server2. I can open the folder from server1 in windows explorer by typing the network path. But in application no access error is occurring(System.Unauthorisedexception). I dont know what access to which user I want to provide? Please help me.
Run your web application under an account that can access the folder on server2. Change the Identity of the Application Pool; more details at https://technet.microsoft.com/en-us/library/cc771170(v=ws.10).aspx.

Can I create a mutual login system for multiple windows store apps?

I have multiple windows store apps of a company and all of them have signing in option. What I am trying to do is create a mutual login system for all of my apps. In simple words, If user log into one app then he automatically signed in other apps.
I am using sqlite locally to maintain user's session data. So, I tried to access the one App sqlite file from other app by giving a static path to its installed location. But it won't open the sqlite file.
Can I put this sqlite file in any folder where other apps can access it too?
Is there any common folder/storage space in windows store app where other apps will be able to access this sqlite file?
Any help would be really appreciated, Thanks in Advance!
Although it doesn't help right now, Windows 10 does have a solution for apps from the same publisher sharing data. You can use ApplicationData.GetPublisherCacheFolder(folderName) to get access to one or more folders that you share amongst your apps.
As far as I know there is no common storage between apps. The best you can do is to store the sqlite file somewhere locally (let the user choose) and then hold permission to access that file in the MostRecentlyUsedList
This will allow your app to access it at any time. However, the user will have to manually open the file at least once with each app that needs to use the login.
The only way I can think of to do what you're trying to do without user interaction would be to write your own server backend and use the IP address / user agent string and other variables to uniquely identify a device. When the device logs in then all other requests from that device would be considered "logged in" until the user logs out from one of them.
This would be very insecure and I would not recommend it. Anyone could impersonate the user if they knew enough about the device they were using, and were behind the same router.

Sharing local storage between different web browsers

Is there any way to share the local storage between different instances of web browsers?
At the moment I have a web browser which saves data in the local storage then with an animation another web browser enter the screen, can I use the data saved by the previous browser?
I have seen that in the isostorage there is a directory Internet Explorer/DOMStore/ which contain some sub-directory and for every browser the localstorage is saved in a different directory. There's any way to prevent this and make them save in the same directory?
I hope I made myself clear on the problem

Categories