By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,639 Members | 2,000 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,639 IT Pros & Developers. It's quick & easy.

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

P: 1
I am trying to get an html page of urls containing special characters as %21,...
"%21" stands for "!",..
e.g.: (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.Create(htmlUri);
responseHtml = requestHtml.GetResponse();

r = new StreamReader(responseHtml.GetResponseStream(),Enco ding.Unicode);

Example 2:
WebClient client = new WebClient();
client.Encoding = Encoding.Unicode;
htmlContentRAW = client.DownloadString(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...
Aug 1 '08 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.