Best way to use blob storage to display images in a web app?

Chris Seigel 21 Reputation points
2021-02-22T15:01:27.073+00:00

I have a .Net app, lets pretend for visual sake its a classifieds app similar to craigslist.
In my code I am uploading images to a blob container no problem, and displaying them to my users via public URL.
Now, I think that its possible that some malicious users may upload raunchy photos or advertisements and use my application to host images for their own purposes which I do not want.
If I only want my blob public url images to be accessible by users who are in my web application (only by my web app), is the best practice to A) somehow utilize the API to assign a temporary token each time the user hits my page? (IE: https://learn.microsoft.com/en-us/rest/api/storageservices/create-service-sas)
Or, B) load the entire image using my controller/backend code and send the bytes to my views with my own code, or C) some third more intelligent option?
thank you so much, im lost on how to proceed with this new app!
-Chris

Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
1,688 questions
{count} votes

Accepted answer
  1. deherman-MSFT 27,091 Reputation points Microsoft Employee
    2021-02-23T21:40:11.633+00:00

    @Chris Seigel

    It sounds like you might find this tutorial helpful. There are also several related questions on Stack Overflow with examples and discussion that are relevant. Example 1 Example 2.

    Hope this helps you get started. If you have further questions issues please let us know.

    -------------------------------

    Please don’t forget to "Accept the answer" and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.

    2 people found this answer helpful.

0 additional answers

Sort by: Most helpful