我想在我的操作中获取 url 以返回页面的 PageRank。我有这样的路线:
routes.MapRoute(
name: "PRURL",
url: "Utility/PR/{*url}",
defaults: new { controller = "Utility", action = "PR", url = UrlParameter.Optional }
);
但是每当我去时,http://localhost:1619/Utility/PR/http://google.com
我都会得到一个System.Web.HttpException
告诉我A potentially dangerous Request.Path value was detected from the client (:).
我想解决这个问题但我不知道如何解决的问题!
有谁能够帮助我?
更新
我试过[ValidateInput(false)]
了,但没有解决问题!动作是这样的:
[ValidateInput(false)]
public string PR(string url)
{
return GooglePageRank.PRChecker.PR(url);
}
通过 添加更新2
<system.web>
<httpRuntime requestValidationMode="2.0" />
</system.web>
问题没有解决!:(
终于
错误解决了,但是 url 从http://google.com
to变成了,我在这里http:/google.com
问了,我得到了答案。