asp.net mvc 3 routing,resource
i use route
routes.MapRoute(
"Search",
"search/{categories}/{sections}/{actions}",
new { controller = "home", action = "search", categories 开发者_StackOverflow中文版= 0, sections = 0, actions = string.Empty }
);
sample : localhost:4304/search/64/0/0
Error (500 or 404) during loading resources because the way href="../../Content/Images/favicon.ico"
conducts not to localhost:4304/Content/Images/favicon.ico
but conducts to localhost:4304/search/Content/Images/favicon.ico
(not found)
Problem with all resources (css, img, js)
It's not a good idea to reference your resource files like that. The best way is to spit out links to them with:
@Url.Content("~/Css/etc.css")
And if you have any images that you need from CSS, just put them in a folder under CSS (example: ~/Css/Images/myImage.jpg) so you can access them from CSS like this:
background-image: url(Images/myImage.jpg)
Now, that being said, the favicon.ico should be in the root of your website and nowhere else, do you have some other situation?
精彩评论