我找不到非法人物
www.rightmove.co.uk/propertyMedia/redirect.html?propertyId=47772832&contentId=778055923&index=0
这是我从调试器中获取的URL。
我在WebClient
的这个方法中使用了上面的URL
string document = w.DownloadString(url);
这会引发异常:
参数异常:路径中的非法字符
当我将URL直接复制到Chrome时,URL工作得很好。知道有什么问题吗?
发布于 2015-03-10 21:21:31
我认为问题在于协议缺失(http
或https
)。
使用Uri.IsWellFormedUriString
检查Uri
是否有效。
假:
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);
https://stackoverflow.com/questions/28978966
复制相似问题