Hi @Abdelrahman Tarek ,
You should build the file path by yourself. Refer to the following sample:
var foldername = "images";
var filename = "Image1.png";
var path1 = Path.Combine(_environment.WebRootPath, foldername, filename);
var path2 = Path.Combine("\\", foldername, filename);
var location = new Uri($"{Request.Scheme}://{Request.Host}/{foldername}/{filename}");
var url = location.AbsoluteUri;
If you want to upload/download file from the wwwroot folder, you can get the file path via the IWebHostENvironment.
If you want to display the image using image control, you can use the relative paths, such as path2 in the above sample.
If you want to store the file path using the request host, directly build the request url, like the path3:
The result as below:
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best regards,
Dillion