webclient download file based on url

static void WebClientDemo()
        {
            string url = "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1601307877228&di=6a286ef6f2ca39ea06a54163728dbf93&imgtype=0&src=http%3A%2F%2F5b0988e595225.cdn.sohucs.com%2Fimages%2F20180422%2Fbd1d3910de4945a7996eee3c1eedd023.jpeg";
            string[] urls = url.Split(new string[] { "/","?","%" }, StringSplitOptions.None);
            string fileName =   urls[urls.Length - 1];
            WebClient wc = new WebClient();
            wc.DownloadFile(url, fileName); 
        }
原文地址:https://www.cnblogs.com/Fred1987/p/13746887.html