如何检测新的Microsoft浏览器“ Edge”在asp.net [英] How to Detect new Microsoft browser "Edge" in asp.net

查看:346
本文介绍了如何检测新的Microsoft浏览器“ Edge”在asp.net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在asp.net中,使用此结构,我如何检测新的Microsoft Edge浏览器?

In asp.net, using this construct, how might I detect the new Microsoft "Edge" browser?

    Dim wrkBrowser As String = ""
    Dim wrkBrowserType As String = HttpContext.Current.Request.Browser.Type
    If InStr(wrkBrowserType, "Chrome") <> 0 Then
        wrkBrowser = "Chrome"
    End If
    If InStr(wrkBrowserType, "MSIE") <> 0 Then
        wrkBrowser = "IE"
    End If
    If InStr(wrkBrowserType, "FireFox") <> 0 Then
        wrkBrowser = "FF"
    End If


推荐答案

我不是任何.NET的专家,但阅读您的代码后,在我看来

I am not an adept in anything .NET, but reading your code, it seems to me that the value returned by

HttpContext.Current.Request.Browser.Type

是用户代理。

您可以在页面。

边缘用户代理:


Mozilla / 5.0(Windows NT 10.0; WOW64)AppleWebKit / 537.36(KHTML,Gecko一样)Chrome / 39.0.2171.71 Safari / 537.36 Edge / 12.0

Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36 Edge/12.0

请注意,该值可以根据移动设备,xbox等进行更改。

Note that the value can change based on mobile, xbox, etc.

因此,请尝试在边缘上进行检查

So in your case, try doing a check on "Edge"

这篇关于如何检测新的Microsoft浏览器“ Edge”在asp.net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆