首页 > Windows开发 > 详细

c# 获取百度最后的url

时间:2017-07-25 09:16:56      阅读:288      评论:0      收藏:0      [点我收藏+]

 

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# 获取百度最后的url

原文:http://www.cnblogs.com/c-x-a/p/7232154.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!