ASP.NET MVC images and other static content url

Viewed 32358

I just edited my route for a user details page to look like this:

        routes.MapRoute(
            "UserDetails", // Route name
            "{controller}/{action}/{id}/{title}", // URL with parameters
            new { controller = "Users", action = "Details", id = UrlParameter.Optional, title = UrlParameter.Optional } // Parameter defaults
            );

Now when my url looks like this: localhost/Users/Details/1/ShawnMclean Images do not load both from the controller and the site.master. (no idea why the css and javascript had correct urls though). If the url is localhost/Users/Details/1 then everything loads fine.

My img in site.master and Details.aspx looks like this in the old url:

<img src="../../Content/Images/logo3.png" />

but when the url gets an additional parameter, the image is actually located at ../../../Content/Images/logo3.png

Is there a way to make images and other static content's url change?

3 Answers
Related