In ASP.NET, how can I find out at runtime whether a client is connecting using HTTP 2 or not?
Interestingly I can't find any relevant properties on System.Web.HttpRequest
(only had a cursory look). You'll want to dig around that and see if there isn't anything new in the vnext APIs, depending on what you're using.
You can also sidestep the potential lack of API if you're using OWIN. The standard mandates a owin.RequestProtocol
property to be set in the request data.
In ASP.NET you can access an OwinContext
object that represents those properties from anywhere with HttpContext.Current.GetOwinContext()
. Alternatively, you can make it accessible by other means (e.g. dependency injection) yourself. This will depend on your environment, look for the OWIN startup class with Katana and vnext.
Install a plugin for HTTP/2 and SPDY ON your Chrome Browser. The plugin will have a lightning symbol in the url address bar. If the lightning symbol becomes blue, it indicates that the communication is happening over HTTP/2.0 . Green color indicates SPDY connection.
For Firefox, go to Developter tools options -> Network, and then connect to the server. You will find Upgrade - h2 on your Response Header . The upgrade h2 indicates that your client is running HTTP/2.0 with your server.
© 2022 - 2024 — McMap. All rights reserved.