c# 获取百度最后的url
2023-09-14 09:06:38 时间
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
namespace getBaiDuUrl
{
class Program
{
static void Main(string[] args)
{
string LastAdurl= GetLocation("http://www.baidu.com/link?url=MW4aqBcVd9VSAsqrVcG8lMzlHUU1qWjFsD_PxZNEjJlxE1sNpirSITeWwcBgcGQ8");
}
public static string GetLocation(string URL)
{
HttpClientHandler hander = new HttpClientHandler();
hander.AllowAutoRedirect = false;
HttpClient client = new HttpClient(hander);
return client.GetAsync(URL).Result.Headers.Location.ToString();
}
}
}
相关文章
- C#+EntityFramework编程方式详细之Model First
- C#多线程技术提高RabbitMQ消费吞吐率
- C#设计模式——策略模式(Strategy Pattern)
- c# assembly.GetManifestResourceStream找不到路径
- C# 可视化与自定义控件开发
- C#中有关资源、BeginInvoke, Invoke和事件的事情
- C#中4种深拷贝方法介绍
- vs2019 实现C#调用c++的dll两种方法
- C#:VARCHART XGantt 5.2.0.167-2022-08-18-UPDATE
- C#编程入门,C#中控件(textBox、checkBox、listBox、listView等等)的应用
- C#数据库编程(建立数据库表,数据库的连接,实现的源代码)