How can I find out whether a client is connecting using HTTP/2?
Asked Answered
L

2

6

In ASP.NET, how can I find out at runtime whether a client is connecting using HTTP 2 or not?

Lashay answered 2/2, 2016 at 11:44 Comment(0)
O
0

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.

Octodecimo answered 2/2, 2016 at 12:49 Comment(0)
I
-1

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.

Intersection answered 2/3, 2016 at 6:38 Comment(1)
I need to find out at runtime on the server for all connecting users.Lashay

© 2022 - 2024 — McMap. All rights reserved.