Mvc relative path using virtual directory..help!
- by kevin
When i drag and drop my image/script/css file into my view, relative path will automatically use to refer on the files.
example:
<link href="../../Content/style.css" rel="stylesheet" type="text/css" />
<script src="../../Scripts/jquery-min.js" type="text/javascript"></script>
<img src="../../Images/logo.jpg" />
It is working fine when i host it on my root directory, but if i'm using virtual directory then only my css file able to refer correctly, the rest will return 404...as it will refer to http://{root}/Images/logo.jpg rather than http://{root}/{virtual directory}/Images/logo.jpg
But why css file is working? and how to specify the relative path correctly for both root & virtual directory cases?