2

I am unable to find illegal characters in

www.rightmove.co.uk/propertyMedia/redirect.html?propertyId=47772832&contentId=778055923&index=0

This is the URL I took from my debugger.

I use the above URL in this method of WebClient

string document = w.DownloadString(url);

This throws an exception:

Argument Exception :Illegal Characters in path

The URL works fine when I copy it into Chrome directly. Any idea what the problem could be?

4

1 回答 1

4

我认为问题是因为缺少协议(httphttps

用于Uri.IsWellFormedUriString检查 anUri是否有效。

错误的:

Uri.IsWellFormedUriString("www.rightmove.co.uk/propertyMedia/redirect.html?propertyId=47772832&contentId=778055923&index=0",UriKind.Absolute);

真的:

Uri.IsWellFormedUriString("http://www.rightmove.co.uk/propertyMedia/redirect.html?propertyId=47772832&contentId=778055923&index=0",UriKind.Absolute);
于 2015-03-11T05:21:31.710 回答