Error getting html page of urls containing special characters (e.g. %)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • themillenium
    New Member
    • Aug 2008
    • 1

    Error getting html page of urls containing special characters (e.g. %)

    Hello!
    I am trying to get an html page of urls containing special characters as %21,...
    "%21" stands for "!",..
    e.g.: http://en.wikipedia.org/wiki/Joan_R%C3%B6ell (this page was picked my random)

    And I need these sites, and there are many sites containing these special characters...

    I tried many variants of getting an html page...
    Example 1:
    requestHtml = WebRequest.Crea te(htmlUri);
    responseHtml = requestHtml.Get Response();

    r = new StreamReader(re sponseHtml.GetR esponseStream() ,Encoding.Unico de);

    Example 2:
    WebClient client = new WebClient();
    client.Encoding = Encoding.Unicod e;
    htmlContentRAW = client.Download String(htmlUri) ;

    ERROR: But the error occurs everytime in the 1st line:
    Error 403.
    The remote server returned an error: (403) Forbidden.

    If I go to the url via IE, it works.... but no url containing special characters works with my application. Hope you can help...
Working...