Ral*_*ing 6 c# ssl asp.net-core-mvc asp.net-core
我想获得有关ASP.NET核心MVC控制器中当前TLS/SSL请求的更多信息.
using Microsoft.AspNetCore.Mvc;
namespace WebApp.Controllers
{
public class HomeController : Controller
{
public IActionResult About()
{
if (HttpContext.Request.IsHttps)
{
// How to get more information about the transport layer ?
ViewData["Message"] = "Connection via TLS/SSL - ... missing details ...";
}
return View();
}
}
}
Run Code Online (Sandbox Code Playgroud)
有没有办法访问使用TLS版本,密码等属性?
我知道在ASP.NET MVC中这是不可能的,如在asp.net mvc 4应用程序中 检查ssl协议,密码和其他属性中所述.也许与Kestrel的新框架提供了迄今为止我无法找到的这种信息.
您可以使用Features中的属性获取这些值HttpContext。如果您致电:
var tlsHandshakeFeature = request.HttpContext.Features.Get<ITlsHandshakeFeature>();
Run Code Online (Sandbox Code Playgroud)
ITlsHandshakeFeature将为您提供 TLS 版本(协议属性)、密码算法等。
您还可以使用ITlsConnectionFeatureGet来为您提供证书。
| 归档时间: |
|
| 查看次数: |
728 次 |
| 最近记录: |