【发布时间】:2014-09-16 12:12:15
【问题描述】:
我正在使用淘汰赛的 observable 将 url 动态绑定到我的 href 标记
<a data-bind="attr: { href: URlPath }">See this</a>
我已经声明 observable 如下
this.URlPath = ko.observable("http://mysite/api/MyMethod&Param1=0000333&Param2=0000000002&Param3=0000000001");
当我点击链接时出现错误
A potentially dangerous Request.Path value was detected from the client (&).
[HttpException (0x80004005): A potentially dangerous Request.Path value was detected from the client (&).]
System.Web.HttpRequest.ValidateInputIfRequiredByConfig() +9561124
System.Web.PipelineStepManager.ValidateHelper(HttpContext context) +53
我尝试在 web.config 中使用下面但没有帮助。我正在使用 WebApi。
<httpRuntime targetFramework="4.5" requestPathInvalidCharacters="<,>,*,%,&,\,?"/>
我也没有任何特殊字符,但我仍然收到此错误。有人可以帮我吗?
更新
这是我在 webapi 中的方法
[ActionName("MyMethod")]
[AcceptVerbsAttribute("GET", "POST")]
[HttpPost]
public HttpResponseMessage MyMethod(string Param1, string Param2, string Param3)
{
//some logic
}
【问题讨论】:
-
你用谷歌搜索过那个错误吗?它有很多结果。 Top Result
-
@xdumaine 我尝试在 webpi 控制器上使用 [ValidateInput(false)] 但似乎它不允许我。我得到语法错误