【发布时间】:2015-05-12 18:58:54
【问题描述】:
我在
中找不到非法字符www.rightmove.co.uk/propertyMedia/redirect.html?propertyId=47772832&contentId=778055923&index=0
这是我从调试器中获取的 URL。
我在WebClient这个方法中使用了上面的URL
string document = w.DownloadString(url);
这会引发异常:
参数异常:路径中的非法字符
当我将 URL 直接复制到 Chrome 中时,它可以正常工作。知道可能是什么问题吗?
【问题讨论】:
-
是否包含协议(http 或 https)?
-
抛出什么类型的异常?一个“WebException”?如果您阅读this,您会发现您需要一个以“http://”等协议开头的正确网址。
-
@QualityCatalyst 参数异常
-
请试试这个,会发生什么?
url = "http:// www.rightmove.co.uk/propertyMedia/redirect.html?propertyId=47772832&contentId=778055923&index=0";. -
@QualityCatalyst 同样的异常 :(
标签: c# string url illegal-characters