从HttpContext的HTTPS检测在​​.net中? [英] Detecting https from HttpContext in .net?

查看:108
本文介绍了从HttpContext的HTTPS检测在​​.net中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我继承了一堆$ C $下一个web应用程序,其中包含的硬codeD路径不减当年。我一直在负责试图让它使用https运行://。

I've inherited a pile of code for a web app which contains oodles of hard-coded paths. I've been tasked with trying to get it to run using https://.

除了检测https://开头?在URL中是否有更多的带内方法来检测当前上下文为https

Other than detecting "https://" in the URL is there a more inband way to detect that the current context is https?

寻找这样的:

System.Web.HttpContext.Current.Request.Url。 Protocol.ToString()

System.Web.HttpContext.Current.Request.Url.Protocol.ToString()

推荐答案

您可以使用 HttpContext.Current.Request.IsSecureConnection

这篇关于从HttpContext的HTTPS检测在​​.net中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆