ASP.net检查,如果网页是HTTP或HTTPS [英] ASP.net check if page is http or https
本文介绍了ASP.net检查,如果网页是HTTP或HTTPS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我主持多个服务器上其中一些是对HTTPS的Web应用程序。如何从code检查,如果一个页面是目前在HTTP或HTTPS?
I have a web application hosted on multiple servers some of which are on https. How can I check from code behind if a page is currently in http or https?
推荐答案
您可以参考的的Htt $ P的
类。对于一个页面,用户控件或类似,使用 Request.IsSecureConnection
属性$ pquest HttpContext.Current.Request.IsSecureConnection
。
You can refer to the Request.IsSecureConnection
property on the HttpRequest
class. For a full reference outside a page, user control or alike, use HttpContext.Current.Request.IsSecureConnection
.
这篇关于ASP.net检查,如果网页是HTTP或HTTPS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文