使用WebClient类,我可以轻松地获得网站的标题:
WebClient x = new WebClient();
string source = x.DownloadString(s);
string title = Regex.Match(source,
@"\<title\b[^>]*\>\s*(?<Title>[\s\S]*?)\</title\>",
RegexOptions.IgnoreCase).Groups["Title"].Value;
Run Code Online (Sandbox Code Playgroud)
我想存储URL和页面标题.但是,当遵循以下链接时:
我显然想要将我重定向到的Url.
质询
有没有办法在WebClient课堂上这样做?
我怎么用HttpResponse和HttpRequest?