当我使用stringbuilder在其中构建一个包含url的表并使用ViewBag在前端发布时,所有反斜杠都会被双引号替换掉? 在cshtm页面中我做了:
@html.Raw(@viewBag.Calendar)
其中calendar是包含表的字符串。原文:
<a href='#' onclick='ShowIframe('https://public.vaptex.nl/OnlineBooking/Search/SearchSimple.aspx?relation=2EFAlKuoQrU%3d&languageid=1&objectid=ukpcLGR14nk%3d&bentityid=5&startdate=01062018&numperiod=1')'>02</a></td>
导致网页
<a href="#" onclick="ShowIframe(" https:="" public.vaptex.nl="" onlinebooking="" search="" searchsimple.aspx?relation="2EFAlKuoQrU%3d&languageid=1&objectid=ukpcLGR14nk%3d&bentityid=5&startdate=01062018&numperiod=1')'">02</a>
答案 0 :(得分:0)
您的原始字符串似乎有不正确的转义序列。尝试使用双引号(&#34;)而不是单引号(&#39;)在ShowIframe()中传递值。
<a href='#' onclick='ShowIframe("https://public.vaptex.nl/OnlineBooking/Search/SearchSimple.aspx?relation=2EFAlKuoQrU%3d&languageid=1&objectid=ukpcLGR14nk%3d&bentityid=5&startdate=01062018&numperiod=1")'>02</a></td>