3

I'm facing a problem where i am trying to call a REST API with some of the slashes encoded.

like so: www.foo.com/method/TV%20Shows%2fEntertainment

Now when calling on a browser that works fine, but when trying to call it using the HttpUtility it looses it's encoding.

This:

'string FeedID = HttpUtility.UrlEncode(Collection.Category);
    HttpWebRequest Request = (HttpWebRequest)WebRequest.Create("www.foo.com/method/" + FeedID);'

Outputs: www.foo.com/method/TV%20Shows/Entertainment

which of course ends up as a 404. Now i understand why and how this happens, i also found the solution here: http://msdn.microsoft.com/en-us/library/ee656542%28v=vs.100%29.aspx

now Comes my problem. When adding the said solution to the app config .NET does not recognize <schemeSettings> as having a child <add>.

the error is as follows. -The element cannot contain white space. Content model is empty. -the element schemeStettings cannot contain child element add because the parent element's content model is empty

<configuration>
  <uri>
    <schemeSettings>
      <add name="http" genericUriParserOptions="DontUnescapePathDotsAndSlashes"/>
    </schemeSettings>
  </uri>
</configuration>

thanks

metaphysics
  • 55
  • 1
  • 4
  • Where do you see the error? On the validation of the web.config file in Visual Studio or when you run the application? If it is just in the validation, what happens when you try and run it? – mikey Jun 05 '13 at 19:54
  • Please refer to my answer here http://stackoverflow.com/a/42994482/4701637 – Himanshu Shirodkar Mar 24 '17 at 08:20

0 Answers0