2014-08-29 70 views
2

A potentially dangerous Request.Path value was detected from the client (:).有潜在危险的Request的值(:) - 角http请求

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: A potentially dangerous Request.Path value was detected from the client (:).

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[HttpException (0x80004005): A potentially dangerous Request.Path value was detected from the client (:).] System.Web.HttpRequest.ValidateInputIfRequiredByConfig() +9560004 System.Web.PipelineStepManager.ValidateHelper(HttpContext context) +53

我的代码:

public List<GetPlayersSiteGoalViewModel> GetPlayers(string teamUrl) 
{ 
    var playersSiteGoal = new List<GetPlayersSiteGoalViewModel>(); 
    return playersSiteGoal; 
} 

角服务方法:

dataBaseService.getPlayers = function (param) { 
       return $http({ 
        method: 'GET', 
        url: getBaseUrl() + dataBaseService.apiController + '/GetPlayers/' + param.TeamUrl 
       }); 
      }; 

更新:

param.TeamUrl

http://www.goal.com/en-us/teams/italy/juventus/1242?ICID=SP_TN_82

我该如何解决这个问题?

回答

1

我认为这里的答案可能会有所帮助:URL Routing, Image Handler & "A potentially dangerous Request.Path value"

它看起来像?由ASP.NET标记为您的网址无效字符。

编辑

回去和重新阅读的错误信息,它看起来像:是你的问题的根源。虽然我没有在你传递的网址中看到它,但它看起来像是在某处添加到网址(可能是getBaseUrl()?)。即使您解决了这个问题,我仍然会根据链接问题中回答提供的无效列表,得到?的另一个错误。

编辑2

您可以通过添加修复:和?到该链接显示的web.config的<httpRuntime requestPathInvalidCharacters属性,或者执行Scott Hanselman在该答案底部的链接中显示的内容:http://www.hanselman.com/blog/ExperimentsInWackinessAllowingPercentsAnglebracketsAndOtherNaughtyThingsInTheASPNETIISRequestURL.aspx

+0

更新问题 – 2014-08-29 14:42:08

0

我找到了。

替换此:

dataBaseService.getPlayers = function (param) { 
       return $http({ 
        method: 'GET', 
        url: getBaseUrl() + dataBaseService.apiController + '/GetPlayers/' + param.TeamUrl 
       }); 
      }; 

与此:

dataBaseService.getPlayers = function (param) { 
       return $http({ 
        url: getBaseUrl() + dataBaseService.apiController + '/GetPlayers', 
        params: { teamUrl: param.TeamUrl } 
       }); 
      };