.net - Getting browser information from IOwinContext -


how can browser iowincontext?

i attempting log requests alongside responses owin middleware (code below).

public async override task invoke(iowincontext context) {     var sw = new stopwatch();     sw.start();     var user = context.authentication.user.identity.isauthenticated ?         context.authentication.user.identity.name :         "anonymous";      _logger.writeverbose(         string.format("{0} {1} '{2}{3}{4}' @ {5} {6}",         context.request.scheme,         context.request.method,         context.request.pathbase,         context.request.path,         context.request.querystring,         context.request.localipaddress,         user));      await next.invoke(context);      _logger.writeverbose(         string.format("{0} {1} {2}ms - {3}",         context.response.statuscode,         context.request.path,         sw.elapsedmilliseconds,         context.request.browser); //??? } 

you can obtain user-agent header request:

context.request.headers.get("user-agent") 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -