I'm saving User's images (let's say Avatar
) from input form to e.g
C:\server_folder\
with random name e.g xcvdfgdfg.jpeg
and store path to it in db.
While loading User's profile e.g First name, second name... I'd want to include that image.
Seems like easy task - I'm just gonna use
_ < img src="@Model.AvatarPath">
But it doesn't work - Image is not being rendered but I can access it when I enter that url manually, meanwhile when I save that image in folder
wwwroot/images
then it works properly with path:
_< img src="~/images/xcvdfgdfg.jpeg" alt="Smiley face"/>
So, basically I'd want to relocate folder
wwwroot/images
to
C:\server_folder
Additionally how can I prevent people from accessing those files if they know url?