我想根据某些事情动态分配href值,重要的是要提到我有一个母版页,url路由并且我正在分配绝对路径(如http://www.stackoverflow.com/questions/ .. .)。
我尝试了以下方法:
<a href="<%= DynamicURL%>">testing urls</a>
<asp:HyperLink runat="server" ID="hpLink">this teset brouw</asp:HyperLink>
在后面的代码中
hpLink.NavigateUrl = "http://www.someurl.com/morepath/morethisngs";
我也试过这个
<a runat="server" id="aAccesories">Testing ...</a>
在后面的代码中我这样做:
aAccesorios.HRef = "http://www.someurl.com/morepath/morethisngs";
当我看到链接呈现这样的 html 源代码时,我尝试过什么:
http://localhost:10027/projectTest/\www.someurl.com/morepath/morethisngs
所以我无法创建绝对路径或绝对 URL,不管我尝试了什么,这很奇怪不是吗?我将域添加到 url,然后删除 http://,然后添加我想要的路径
希望你能帮助我,谢谢!