2
votes

A potentially dangerous Request.Path value was detected from the client (:).

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

My code:

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

Angular Service Method:

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

Update :

param.TeamUrl:

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

How do I fix this?

2

2 Answers

1
votes

i found.

replace this :

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

with this :

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

I think the answer here may be of some help: URL Routing, Image Handler & "A potentially dangerous Request.Path value"

It looks like ? is marked by ASP.NET as an invalid character in your URL.

Edit

Going back and re-reading the error message, it looks like : is the source of your problem. While I don't see it in the url you pass, it looks like it is getting added to the url somewhere (maybe by getBaseUrl()?). Even if you fix that, I assume you would get another error with ? based on the invalid list supplied by the answer in the linked question.

Edit 2

You can fix it by either adding : and ? to the <httpRuntime requestPathInvalidCharacters property of the web.config as that link shows, or do what Scott Hanselman shows in the link at the bottom of that answer: http://www.hanselman.com/blog/ExperimentsInWackinessAllowingPercentsAnglebracketsAndOtherNaughtyThingsInTheASPNETIISRequestURL.aspx