WebRequest.GetResponse fails with HTTP-400 for slash (%2F) in REST based URI

Hi,

I have a MAC app that call a REST web service.

I am doing a POST request to the following REST based URI:

192.168.27.106:443/users/a%2Fb

I am using WebRequest.GetResponse but it returns HTTP-400.
I know it is related to URI. I saw some posts here but they don't seem to work for me with WebRequest.
http://stackoverflow.com/questions/5774183/how-to-make-system-uri-not-to-unescape-2f-slash-in-path
http://stackoverflow.com/questions/11478002/url-encode-forward-slash-in-net
http://stackoverflow.com/questions/2287639/help-with-c-sharp-httpwebrequest-uri-losing-its-encoding
http://stackoverflow.com/questions/14942621/sending-a-json-serialized-object-containing-a-escaped-string-using-httpwebreques

Also, tried to set the following in app.config:
name="https" genericUriParserOptions="DontUnescapePathDotsAndSlashes"

Can someone help me figure out what am I doing wrong here or if there is a better way to do this?

Thanks
Nimish

Tagged:

Posts

  • ChrisHamonsChrisHamons USForum Administrator, Xamarin Team Xamurai

    Since WebRequest.GetResponse is a generic C# API and not a Xamarin.Mac specific API, would you like me to move this post to a more general forum that might get more traffic (and eyes).

    I don't happen to know the answer off the top of my head.

  • ChrisHamonsChrisHamons USForum Administrator, Xamarin Team Xamurai

    I also notice you appear to have a business license, so you are eligible to contact support via http://xamarin.com/support if you desire.

  • I will move to a general forum and contact support .. Thanks Chris

  • ChrisHamonsChrisHamons USForum Administrator, Xamarin Team Xamurai

    I believe I've moved it to the right forum.

  • Thanks Chris.

Sign In or Register to comment.