這是有問題的URL,導致我的所有圖像中斷。ASP.NET MVC - 路由問題
http://www.foo.com/payment/receipt/stapia.gutierrez/201110040000034
我的_Layout.cshtml文件中聲明瞭我的所有內容(圖片和whatnot)。我相信這是我的路由問題。
這裏是我的Global.asax路由區的相關部分:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"AllPayments",
"payment/receipt/{username}",
new { controller = "Payment", action = "AllPayments" }
);
routes.MapRoute(
"IndividualPayment",
"payment/receipt/{username}/{id}",
new { controller = "Payment", action = "SinglePayment" }
);
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
}
這是我的圖片是如何在我的_Layout.cshtml文件中聲明:
<img src="../../Content/SiteImages/banner1.jpg" width="200" height="200" />
<img src="../../Content/SiteImages/banner2.jpg" width="200" height="200" />
<img src="../../Content/SiteImages/banner3.jpg" width="200" height="200" />
而正常情況下我的圖像將src
到
www.foo.com/Content/SiteImages/logo.png
,
在此特別的看法,他們改爲
www.foo.com/payment/Content/SiteImages/logo.png
我該如何解決這個問題?什麼導致我的圖像src在這個特定的視圖中改變?
標記是什麼樣的? – yoozer8
@Jim:請參閱編輯。 :) –