Mvc relative path using virtual directory..help!
Posted
by kevin
on Stack Overflow
See other posts from Stack Overflow
or by kevin
Published on 2010-05-18T04:44:24Z
Indexed on
2010/05/18
4:50 UTC
Read the original article
Hit count: 408
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?
© Stack Overflow or respective owner