简体   繁体   中英

HTTPS availablity of http url

I am having list of http urls, I need to find https url is available or not. Example : http://www.apra.gov.au/Insight/Pages/insight-issue2-2017.html , need to check whether https is available on the same domain via c# code. since I have a list of 5k http urls. I need to verify all these url available on HTTPS?

You can probably do a simle string replace (http: = https: ) and then loop through them all calling httpget to check:

Psuedo code:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM