0

I have some MVC applications. They are set up in virtual directories on my local machine. On live they are set up on root website installations.

this means that an image in both scenarios would be...

local

/mysite/images/image1.jpg

dev

/images/image1.jpg

I have looked at the @Url helper but cant see what exactly I should do with it....

Exitos
  • 29,230
  • 38
  • 123
  • 178
  • Let me know if this helped you. http://stackoverflow.com/questions/2418050/should-i-use-url-content-or-resolveurl-in-my-mvc-views – coffeeyesplease Apr 19 '12 at 10:52

1 Answers1

1

You should always use url helpers when generating urls in ASP.NET MVC. For example instead of:

<img src="/images/image1.jpg" />

you should write:

<img src="@Url.Content("~/images/image1.jpg")" />
Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928