简体   繁体   中英

Test Client's ability to connect via https - ASP.net

I have an ASP.Net page that when the user arrives, I would like to test if they are able to connect to another page on my server via HTTPS connection. If TLS is not enabled in the user's settings, they are being refused access.

If the test fails, then I would like to display a specific message.

I have considered using:

WebClient _client = new WebClient();

and

HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://myurl....");

but these are performing the requests from the server side and therefore they connect without issue even if the client can't connect themselves.

I have also considered an ajax request; however, I cannot make an https request from http because of the Same Origin Policy

Do you all have any ideas that would allow me to test https while on an http page?

Thanks in advance

您可以在HTTPS页面中创建指向有效图像的<img>标记,然后处理其loaderror事件。

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