HTTP URL的HTTPS可用性

时间:2019-02-22 10:27:55

标签: c# http https

我有http网址列表,我需要查找https网址是否可用。示例:http://www.apra.gov.au/Insight/Pages/insight-issue2-2017.html,需要通过c#代码检查https在同一个域中是否可用。因为我有一个5k http网址列表。我需要验证HTTPS上所有可用的URL?

1 个答案:

答案 0 :(得分:0)

您可能可以执行一个简单的字符串替换(http:= https:),然后遍历它们,全部调用httpget进行检查:

伪代码:

var httpClient = new HttpClient()
foreach(var url in urls)
   var httpUrl = url.Replace("http:","https:");
   httpClient.Get(url);