zoukankan      html  css  js  c++  java
  • c# 获取百度最后的url

     

    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();
    }
    }
    }

     

  • 相关阅读:
    Windows系统的DOS常用命令
    常用pom
    ssm整合
    pom依赖集合
    json
    软件项目管理笔记-软件项目计划
    CSS
    网络配置
    用户组
    用户管理
  • 原文地址:https://www.cnblogs.com/c-x-a/p/7232154.html
Copyright © 2011-2022 走看看