Trying to get the user-agent from request in asp.net web api self host

后端 未结 5 1843
轻奢々
轻奢々 2021-02-05 00:21

I\'m trying to get the user-agent in a web api self host and I\'m either doing it wrong, or the web api itself is altering the user agent string.

I\'ve tried using sever

5条回答
  •  臣服心动
    2021-02-05 00:52

    .NET Core 2.0(+)

    As Simple as Request.Headers["User-Agent"] (returns as string) ;)

提交回复
热议问题