服务器端变量无法在link元素中解析 [英] server side variable cannot be resolved in link element

查看:81
本文介绍了服务器端变量无法在link元素中解析的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨:

我一直在挠头,试图解决这个问题。我有一个site.master页面$


而我只是想做一件简单的事情。我在标题中加了一个链接元素




  < link rel =" canonical" HREF ="<%= CannoicalURL%GT;" />
$



以上,但总是解析为"Views / CMSTemplates /%3C%25 =%20CannoicalURL%20% 25%3E"


所以换句话说,CannoicalURL的值甚至没有渲染



CannoicalURL是我设置的字符串变量后面的代码,我检查了调试器中的值,它很好...



此外,我甚至创建了一个dummie javascript以下为


    < script>

        

        var a =<%= CannoicalURL%> ;;

    < / script>



这完美无缺。



有人可以解释为什么它与< link>无法完全兼容元件?任何解决方案/建议都会很棒。



谢谢

解决方案

ASP.net问题@ http:/ /forums.asp.net。

Hi:
I have been scratching my head and trying to figure this out. I have a site.master page

and I am just trying to do a simple thing. I am including a link element in the header


  <link rel="canonical" href="<%=CannoicalURL%>" />


the above however, always resolves to "Views/CMSTemplates/%3C%25=%20CannoicalURL%20%25%3E"
So in other words, the value of CannoicalURL isn't even rendered

CannoicalURL is a string variable i set in the code behind, i checked the value in debugger and it is fine...

Further more, I even created a dummie javascript below

    <script>
        
        var a = <%=CannoicalURL%>;
    </script>

And this works perfectly.

Can somebody explain why it doesnt quite work with <link> element? Any solutions/suggestions would be great.

Thanks

解决方案

ASP.net questions @ http://forums.asp.net.


这篇关于服务器端变量无法在link元素中解析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆