How to handle relative paths in ASP.NET MVC?

Posted by AngryHacker on Stack Overflow See other posts from Stack Overflow or by AngryHacker
Published on 2010-03-21T04:40:05Z Indexed on 2010/03/21 4:41 UTC
Read the original article Hit count: 481

I have a master page which references a style in the following manner:

<link rel="stylesheet" type="text/css" href="../../Content/Style.css" /> 

All my pages inherit from this master page. And this works well when the URL is http://www.domain.com/home/details/5, however the URL is http://www.domain.com/home/create, then, of course, Style.css cannot be found because `../../Content/Style.css' resolves to a directory one higher where there is nothing there.

How is this typically handled?

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about relative-path