简体   繁体   中英

Request URL with HTTP or HTTPS in C#

I have two inputs for set urls, first for image and second for some site

I must to load image and site in iframe

If user set url with scheme everything is ok, the problems spears when url does not contains the scheme ' http:// ' or ' https:// '

how to add right scheme to url

make a request to ' http:// ' + my_url and check if the code if is 404 make another request to ' https:// ' + my_url

I think this one can help you if you mean this what i think.

How can I catch a 404? if there's a 404 you run the same code with and without "https" it's on you on which one you start "requesting".

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