I need to be able to place images in a path relative to the view, but I'm not sure how to accomplish this, because I don't have a very good grasp of MVC routing:
If I have a route like this:
routes.MapRoute(
"Parameter",
"{controller}/{action}/{lang}/{prod}",
new { controller = "Manuals", action = "Product", lang = "en-US", prod = "productname" }
And then I try to use a relative path for the images:
<embed class="images src="@Url.Content("images/sampleimage.svg")"></embed>
This gives me a path (if I inspect it in the web inspector) that looks like this: src="http://localhost/Manuals/Product/en-US/images/sampleimage.svg"
which is not where the image is. It is located physically at "http://localhost/Views/Manuals/en-US/productname/images/sampleimage.svg"
So basically, the Views folder, and then no folder like the action name (Product). So how can I use paths relative to the view in this environment? The action becomes part of the url, but there is no actual folder named like the action method, and also the images will be under the Views folder which is not part of the url here... Also, the last part of the url in the route (productname) does not seem to show up at all in the image path, it seems to be interpreted as an id or something because I use only one action method to serve the views based on parameters lang and prod?
Is there no way to place images like this, and use relative paths like "images/imagename.svg" or the like? Or am I just misunderstanding the routing in MVC?
I need to do it like this to simplify adding content which is massive and the result of XSL transformations...
EDIT: Sorry, I had some of the urls incorrect as to the results I got. Should be fixed now to reflect what I have.