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

Asked By anbu n on 26-Aug-14 12:45 PM
  --- My c# code to access sharepoint 2013 rest api to upload file share point,
 
But i am getting error - A potentially dangerous Request.Path value was detected from the client (:).
 
 
 
---------------------------
 
 
A potentially dangerous Request.Path value was detected from the client (:).
Ravinder Jamgotre replied to anbu n on 11-May-16 07:47 AM
The * character is not allowed in the path of the URL, but there is no problem using it in the query string:

http://localhost:3286/Search/?q=test*
It's not an encoding issue, the * character has no special meaning in an URL, so it doesn't matter if you URL encode it or not. You would need to encode it using a different scheme, and then decode it.

For example using an arbitrary character as escape character:

query = query.Replace("x", "xxx").Replace("y", "xxy").Replace("*", "xyy");
And decoding:

query = query.Replace("xyy", "*").Replace("xxy", "y").Replace("xxx", "x");