【问题标题】:Mobile Request Detection and Redirect to Mobile Pages in Asp (Active Server Pages)移动请求检测和重定向到 Asp 中的移动页面(活动服务器页面)
【发布时间】:2012-04-17 07:51:43
【问题描述】:

我有一个 web 应用程序,它已经在 asp(Active Server Pages)中创建,现在该 web 应用程序模块的一部分被转换为移动站点(通常批准或拒绝发票),所以每当请求来自移动设备 我想将请求传输到移动站点,那么如何在我的 asp 登录中检测到设备,以便我可以将请求重定向到移动登录页面...??

【问题讨论】:

    标签: c# javascript asp.net vbscript


    【解决方案1】:

    你需要看看你得到的是什么用户代理。如this SO 线程所述:

    private static string[] mobileDevices = new string[] {"iphone","ppc"
                                                          "windows ce","blackberry",
                                                          "opera mini","mobile","palm"
                                                          "portable","opera mobi" };
    
    public static bool IsMobileDevice(string userAgent)  
    {  
        // TODO: null check
        userAgent = userAgent.ToLower();  
        return mobileDevices.Any(x => userAgent.Contains(x));
    }
    

    更新:我对 ASP 了解不多,但我认为 this 应该让你走上正轨。

    【讨论】:

    • 我的移动网站在 asp.net 中,但我现有的网站在 asp 中,所以我如何在我的 asp 页面中添加它,即我的 login.asp 页面
    【解决方案2】:

    您可以为此使用Mobile ESP 库。甚至移植到ASP Classic ;)。

    多次使用 ASP Classic 端口,效果非常棒。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-06-10
      • 2011-06-29
      • 1970-01-01
      • 1970-01-01
      • 2011-02-18
      • 1970-01-01
      • 1970-01-01
      • 2014-02-24
      相关资源
      最近更新 更多