相关疑难解决方法(0)

在C#中使用WebClient有没有办法在重定向后获取站点的URL?

使用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和页面标题.但是,当遵循以下链接时:

http://tinyurl.com/dbysxp

我显然想要将我重定向到的Url.

质询

有没有办法在WebClient课堂上这样做?

我怎么用HttpResponseHttpRequest

.net c# regex http

41
推荐指数
3
解决办法
6万
查看次数

标签 统计

.net ×1

c# ×1

http ×1

regex ×1