How to detect user agent in WCF web service

前端 未结 5 1556
广开言路
广开言路 2021-01-05 17:36

How can I detect the user agent in a web service? My web service is implemented using a WCF webservice with basicHTTPBinding. It will be a post from some SOAP clients. I wis

5条回答
  •  梦毁少年i
    2021-01-05 18:14

    There is another way to get the user agent without enabling ASP.NET compatibility in web.config:

    string userAgent = WebOperationContext.Current.IncomingRequest.Headers["User-Agent"];

提交回复
热议问题