Lasse Lasse - 27 days ago 4
ASP.NET (C#) Question

How do I get protocol version from System.Web.HttpRequest?

I have an Nginx server reverse-proxying my IIS server running af .NET Runtime 4 Web Forms application.

I'm trying to find out what HTTP version (1.0 or 1.1) Nginx is using when making requests to the IIS.

How do I get the HTTP version from the current request?

I've tried searching and looking through the documentation. Closest I've found is the

of
System.Net.HttpWebRequest
but
HttpRequest
doesn't have the same property and it seems I can't cast it.

(BTW: I realise that the HTTP version rarely matter these days but it's in relation to some debugging I'm doing)

Answer

This value is in Request.Params["SERVER_PROTOCOL"] and holds, for example, "HTTP/1.1".