There is a masterpage in asp.net which I want to use
<link href="<%= this.ResolveClientUrl("~/script/css/test.css") %>" type="text/css" rel="stylesheet">
When I see the view source in IE, it becomes empty:
<link href="" type="text/css" rel="stylesheet">
I also tried <%= Request.ApplicationPath %> + /script/css/test.css
It only showed /script/css/test.css
How should I use ResolveClientUrl in Masterpage? as the current relative path needs ../../script/css/test.css which work. Otherwise, it does not work
The header html code saved in a html file.
<head runat="server">
<title></title>
<script></script>
<link href="<%= Page.ResolveClientUrl("~") %>script/css/test.css" type="text/css" rel="stylesheet" />
</head>
and located in
/product/info/header.html
I use Server.MapPath to load the html in index.aspx.cs Page_Load
ParseControl and add to the PlaceHolder in masterpage.
All code in html can display properly.
However, only Page.ResolveClientUrl("~") become empty.
If I put ResolveClientUrl in index.aspx.cs, it can show ../../script/css/test.css
If I put Page.ResolveClientUrl in masterpage, it can also show
../../script/css/test.css
However, when I parse the header.html to the placeholder controller, it becomes empty.
How should I fix it?
I tried many methods to do it but still failed.
pradyahuja
change the code to
<head runat="server">
<title></title>
<script></script>
<link href="~/script/css/test.css" type="text/css" rel="stylesheet" />
</head>
<link href="<%= Page.ResolveClientUrl("~")