I want to get the absolute path of a static file using @Url.Content on a razor view to use it as a value of content attr of a meta tag but It's seems not working for me I didn't know what is the problem.
@{
var pageThumbnail = Url.Content("~/assets/121545/mid.jpg");
}
@section Meta {
<meta property="og:image" content="@pageThumbnail" />
}
Result :
<meta property="og:image" content="/assets/121545/mid.jpg" />
I expected this result instead:
<meta property="og:image" content="https://localhost:5001/assets/121545/mid.jpg" />