How to get a base url for Asp.Net Core Application in the Razor View Page

Problem: If you are working in Asp.Net Core application and would like to get the application Base Url to append a resource url like an image see solution below:

solution: @Url.Content("~/ResourceFile") #the outcome will be https://www.domainName/ResourceFile

Edit this Article Core 3.1 mvc core errors web forms core tutorial Technology published
Was this page helpful?
Yes Yes! this solution to the problem was helpful. No No! this solution to the problem was not helpful.. Leave ErnesTech Feedback.Feedback
If you log in, you will be notified when someone leaves a comment.

Other users would like to know if this solution helped you.

Your Session is Ending
Login to Continue

© 2021 - ErnesTech - Privacy