href 正在截断查询字符串
href is truncating querystring
我在变量中有以下查询字符串
var redirectTo = "http://localhost/DGS.DGSAPI.UI/ORDERONLINE?addr=10 n main&apt=&zip=44408&customer=N";
在 View 上呈现,例如:
<a href=@redirectTo>Check Here</a>
但是当它呈现时,它会在找到 space 后截断。它呈现如下:
怎么了?
使用引号,没有它 space
会使浏览器认为新属性开始:
<a href="@redirectTo">Check Here</a>
另请注意,查询字符串参数中的空格通常编码为 +
符号。因此,即使添加了引号,URL 仍然可能在打开时无法正常工作。
我在变量中有以下查询字符串
var redirectTo = "http://localhost/DGS.DGSAPI.UI/ORDERONLINE?addr=10 n main&apt=&zip=44408&customer=N";
在 View 上呈现,例如:
<a href=@redirectTo>Check Here</a>
但是当它呈现时,它会在找到 space 后截断。它呈现如下:
怎么了?
使用引号,没有它 space
会使浏览器认为新属性开始:
<a href="@redirectTo">Check Here</a>
另请注意,查询字符串参数中的空格通常编码为 +
符号。因此,即使添加了引号,URL 仍然可能在打开时无法正常工作。