Reputation: 33
I have a MVC web application. The start url is //foo/login/index. On a view I show a picture images/bar.jpg. The image is in de directory //foo/images
On my working station this works but when I install it on the test server the site can't find the image because it url to the image is: //foo/login/images/bar.jpg instead of //foo/images/bar.jpg
So my current directory on my workstation differs from that on the test server.
My question: What determines the current directory in a mvc web application
Upvotes: 0
Views: 130
Reputation: 24280
You probably have something like this in your View:
<img src="images/bar.jpg">
Replace it with:
<img src="~/images/bar.jpg">
The tilde or ~ character is resolved by the rendering engine at runtime to the root (home path) of your website.
Upvotes: 1