开发者

Images' site don't loading with a specific url in mvc

I'm using ASP.NET MVC 1.0 and I try to create a personal blog!

I have a problem with an url that it has to show all post wrote开发者_开发问答 in a specific year and specific month.

My url is look like(http://localhost:2282/Blog/Archive/2010/5).

So... it work correctly, infact it show all record that have year=2010 and month=5 but my problem is that when I use this url, images in total my site are no longer loading.

I have this problem only with this url's type.

I think that the problem maybe is my maproute?

 routes.MapRoute(
         "ArchiveRoute",
         "Blog/Archive/{anno}/{mese}",
         new { controller = "Blog", Action = "Archive",anno = @"\d{4}", mese = @"\d{2}" }     
      );

Why images don't loading with this url?

Thanks


Your View may be referencing images using a relative path that doesn't work based on your current route. URLs you use in your view need to be relative to the resulting action's URL, not the folder where the view is stored.

You could use an absolute path or use <img src="<%=Url.Content("~/images")%>/image.jpg" alt="" /> (replace "~/images" with the path to your images, where "~/" equals the root of your application).

If you're using a Master page, it too should be careful to use something like Url.Content, because the Master can get used by different views that are accessible by different URLs!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜