Some Server Variables Not Available from OwinContext
In theory, the OwinContext environment should be able to access the request / response information as well as the server variables, although for some reason from OwinContext I cannot access some of the custom server variables that are available from the collection Request.ServerVariables
.
What is causing this inconsistency and how can I get around it?
+3
source to share
1 answer
I just stumbled upon this myself. It turns out you can access HttpContextWrapper
from IOwinContext.Environment
:
var httpContextWrapper = owinContext.Environment["System.Web.HttpContextBase"] as HttpContextWrapper;
Then you can access the property Request
:
httpContextWrapper.Request.ServerVariables
+5
source to share