3

Possible Duplicate:
HttpWebRequest to URL with dot at the end

I am facing a weird problem. When I am trying to get a page using HttpWebRequest page is not coming properly. The url has a dot into it like http://www.xyz.com/abc./do . You can see this url has a dot into it. So when I am trying fetching that data using HttpWebRequest data is not coming properly. So I tracked it with fiddler and I saw this class omitting the dot like http://www.xyz.com/abc/do . How can I solve this problem ?

NB. This is not a real url. But the problem is real.

Community
  • 1
  • 1
Barun
  • 1,885
  • 3
  • 27
  • 47
  • as I can see you are missing forward slash it should be http:// – Senad Meškin Jul 08 '11 at 15:33
  • Sorry another type mistake. I have modified it. – Barun Jul 08 '11 at 15:37
  • Yeah sure. http://www.automatica-munich.com/exvi/en/bfa_solutions_ltd./CH/A1/328 – Barun Jul 08 '11 at 15:38
  • I've tried to open it in my browser and it doesn't work... – Senad Meškin Jul 08 '11 at 15:38
  • @Senad Meškin: Sorry that is not a real url. I am just trying to express my problem. – Barun Jul 08 '11 at 15:40
  • can you post a code you are using ? – Amir Jul 08 '11 at 15:43
  • I'm able to navigate to the URL @Barun provided with IE9, Chrome 12, and FF4. I would normally argue that the URL is not correctly formatted and therefore I wouldn't expect the HttpWebRequest to accept it - however, the browsers don't seem to mind it. – Smudge202 Jul 08 '11 at 15:45
  • 2
    Interesting - I can't find any other problems like this - nor cna I find a way (so far) to prevent the address being parsed and the "." being removed. You can't escape the character obviously, and even if you try Uri x = new Uri("http://www.automatica-munich.com/exvi/en/bfa_solutions_ltd./CH/A1/328"); you'll see the same behaviour. I still think the URL provided is badly formatted, but no idea how to handle it... – Smudge202 Jul 08 '11 at 16:01
  • Well found @Jamiec. That _should_ do the trick, and it figures that it's an MS bug. I wouldn't say it's a duplicate simply due to the positioning of the dots - one being trailing, one being mid-address. Anyone with time fancy checking if this particular case is a _valid_ Url? – Smudge202 Jul 08 '11 at 16:12
  • Its a valid url for browsers, and the workaround in the linked question does work with this url. I tested it but im not putting an answer here as its just the same thing. – Jamiec Jul 08 '11 at 16:15
  • What are you guyz talking about ? – Barun Jul 08 '11 at 16:20
  • @Barun see the question Jameic linked. That solution should work for you. – Davy8 Jul 08 '11 at 16:23

1 Answers1

1

may be encoding url solve the problem

HttpUtility.UrlEncodeUnicode(url)
ehsan
  • 787
  • 3
  • 13
  • 26