草庐IT

userBrowser

全部标签

c# - 您将如何检测 Api Controller 中的当前浏览器?

我正在尝试使用MVC4在我的程序中的一个ApiController中检测当前的Web浏览器。我看到人们到处都说要使用Request.Browser,但我无法让它工作。有什么建议或我忽略了什么吗? 最佳答案 您可以像这样在System.Web中使用HttpBrowserCapabilitiesvaruserAgent=HttpContext.Current.Request.UserAgent;varuserBrowser=newHttpBrowserCapabilities{Capabilities=newHashtable{{str

c# - 您将如何检测 Api Controller 中的当前浏览器?

我正在尝试使用MVC4在我的程序中的一个ApiController中检测当前的Web浏览器。我看到人们到处都说要使用Request.Browser,但我无法让它工作。有什么建议或我忽略了什么吗? 最佳答案 您可以像这样在System.Web中使用HttpBrowserCapabilitiesvaruserAgent=HttpContext.Current.Request.UserAgent;varuserBrowser=newHttpBrowserCapabilities{Capabilities=newHashtable{{str