Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想通过查询字符串将新闻标题发送到其他页面。我的标题是动态的,因此它可能包含“&”或其他特殊字符。所以我尝试了这个
<a href="NewsByTitle.aspx?title=<%#HttpServerUtility.HtmlEncode(XPath("title"))%>"
但我收到错误“'System.Web.HttpServerUtility.HtmlEncode(string)' 的最佳重载方法匹配有一些无效参数”请帮助我。
替换为以下代码:
<a href='NewsByTitle.aspx?title=<%#Server.UrlEncode( XPath("@title").ToString()) %>' ><%# XPath("@title") %></a>