Solution 1:

In C#, the relative root path can be referenced by "~/". This tells the web app that the directory of the item you are looking for is relative to the root of the project, rather than the current view.

For example, if you are at the resource /Home/Index, and add the content @Url.Content("img/my_image.png"), then the request will be made to "/Home/Index/img/my_image.png." However, this is likely not where you keep your images, and instead you probably have an image folder in the root of your directory (or, in the MVC world, in the Content folder). So, more likely you desire @Url.Content("~/img/my_image.png").

However, the "~" character does not universally denote the relative root path. If you add "~/" to a link, the browser will interpret the tilde as a directory, and since the link does not contain a root path symbol ("/"), the broswer will create a link relative to the current directory. This results in a path of "/~/...", which, most likely, does not exist.

In short, whenever you are creating relative links in HTML/JavaScript, make sure you omit the "~" character, and this should resolve your issue.

Solution 2:

Use Relative Path using "/"

/RootDirectory/Cotent/img/bug.jpg

If Cotent folder is within the RootDirectory Then Use Below

/Cotent/img/bug.jpg