views:

662

answers:

2

I have a new asp.net mvc project and i am trying to figure out the best place to store images and also how i would reference them from site.master (in cases where i have a header images that i want to show up on all pages).

Suggestions or best practices?

+2  A: 
Jericho
i am trying to put the image link in the site.master file so it shows up on every page.
ooo
Then all you have to do is create a div and put your image as a backround for that div which will only be in your site.master. Hence displaying it in every page. If you do not know how to link your css then that's what you should have asked.
Jericho
You are asking for best practices, well in reality it is up to the person. But I have found the hard way to place stuff like that on the page itself, when if I want it done in a more general way the best place I have found is the Css.
Jericho
For those that downvoted this, I'd like to know what's a better solution that Content/Images. Regarding showing the image in all pages, what about just putting an img on site.master?
J. Pablo Fernández
Content/Images is fine, but the way you reference the images is not. It only works with the development web server and on the root web application in IIS. If you run a web application in a virtual directory, the images are never found
chris166
+2  A: 
<%=Html.Image("~/Content/Images/xxx.png")%>

This resolves from wherever you are in the site hierarchy. Html.Image is a part of the the Microsoft.Web.Mvc futures assembly.

mxmissile