我想获得网站页面标题。如果我想解释我想要的东西,请阅读。 当你去www.yahoo.com点击一个有这个链接的新闻标题的链接
我们可以看到页面标题是----
我的问题是如何在yahoo.com或任何其他网站之后获得页面标题。
请指导我在asp.net 毕竟非常感谢。
答案 0 :(得分:0)
假设url是一个字符串变量,那么在c#中你需要的是Path.GetFileNameWithoutExtension。见here
e.g。
string url = "https://en-maktoob.news.yahoo.com/mahesh-bhatt-bheegh-loon-celebrates-unleashing-womans-sensuality-133609637.html";
Console.WriteLine("{0}",Path.GetFileNameWithoutExtension(url));
输出
mahesh-bhatt-bheegh-loon-celebrates-unleashing-womans-sensuality-133609637