我想在我的操作中獲取網址以返回網頁的PageRank。我有這樣的路線:獲取像http://google.com一樣的完整網址作爲操作輸入
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)]
但它並沒有解決這個問題! 動作是這樣的:通過添加
<system.web>
<httpRuntime requestValidationMode="2.0" />
</system.web>
問題沒有解決
[ValidateInput(false)]
public string PR(string url)
{
return GooglePageRank.PRChecker.PR(url);
}
UPDATE2 ! :(
終於 錯誤解決,但該網址從http://google.com
改爲http:/google.com
,我問它here,我得到了答案。
看看這個http://stackoverflow.com/questions/6025522/getting-a-potentially-dangerous-request-path-value-was-detected-from-the-client – Charlie 2012-08-07 04:16:21