Css and JavaScript Urls

Including javascript and css can be a pain if not all pages are placed in the same paths relative to the css and javascript files. Here's a way to avoid the problem.

    <link id="common-css" runat="server" href="~/css/common.css" rel="stylesheet" />

    <script src="<%= ResolveUrl("~/js/jquery-1.9.1.min.js")%>" type="text/javascript"></script>

Post a comment

Comments closed