Reputation: 1414
I have placed my program within a subfolder on the server: localhost/program and when the program runs it runs correctly however all action links and images point to localhost/... rather than localhost/program/...?
I have tried to change my routing by adding "program/" to the beginning of "{controller}/.." however this seems to have little effect? Any suggestions?
Upvotes: 0
Views: 42
Reputation: 54638
You should use Url.Content
to solve a url for any file or resource on your site. The parameter passed is the relative path prefixed with a tidle (~):
<img src="@Url.Content("~/image/logo.jpg")"/>
The result would be (based on your setup):
<img src="http://localhost/program/image/logo.jpg"/>
A relative virtual path is relative to the application root directory, if it is just a tilde (~) or starts with the tilde and a double backslash (~\\) or the tilde and a slash mark (~/).
Upvotes: 2