IsMobileDevice returns false when connecting with WM 2003

Discussion in 'ASP .Net' started by Sacha Korell, Dec 22, 2004.

  1. Sacha Korell

    Sacha Korell Guest

    First of all, sorry for cross-posting, but this newsgroup is much busier
    than "aspnet.mobile".

    I'm trying to create a portal page that redirects depending on the device
    that is connecting.

    When I use Request.Browser("IsMobileDevice"), it returns false when
    connecting with my iPAQ
    2215 (and other Windows Mobile 2003 devices), although
    HTTPBrowserCapabilities "Platform" returns "WinCE".

    What's going on? I'm using VS.NET2003 for development with DeviceUpdate4
    installed.

    I had a code snippet like (suggested by the MS "Best Practices" page at
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnmitta/html/bestpractaui.asp):

    If Not (Page.IsPostBack) Then
    If (Device.IsMobileDevice) Then
    RedirectToMobilePage("mobile/m_default.aspx")
    Else
    Response.Redirect("default.aspx")
    End If
    End If

    It used to work just fine, but now "Device.IsMobileDevice" also returns
    false.

    Does anybody in this group have a clue why this is happening?

    Also, why is has MS not released another device update? The latest one is
    over a year old.

    Thanks,

    Sacha
     
    Sacha Korell, Dec 22, 2004
    #1
    1. Advertising

  2. Sacha Korell

    Alex Homer Guest

    IsMobileDevice is a property of the MobileCapabilities class. You need to
    inherit the MobilePage and cast the Request.Browser instance to a
    MobileCapabilities instance:

    <%@ Page Inherits="System.Web.UI.MobileControls.MobilePage"
    Language="whatever" %>
    <%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls"
    Assembly="System.Web.Mobile" %>

    MobileCapabilities currentCapabilities =
    (MobileCapabilities)Request.Browser;
    result = currentCapabilities.IsMobileDevice;


    "Sacha Korell" <> wrote in message
    news:...
    > First of all, sorry for cross-posting, but this newsgroup is much busier
    > than "aspnet.mobile".
    >
    > I'm trying to create a portal page that redirects depending on the device
    > that is connecting.
    >
    > When I use Request.Browser("IsMobileDevice"), it returns false when
    > connecting with my iPAQ
    > 2215 (and other Windows Mobile 2003 devices), although
    > HTTPBrowserCapabilities "Platform" returns "WinCE".
    >
    > What's going on? I'm using VS.NET2003 for development with DeviceUpdate4
    > installed.
    >
    > I had a code snippet like (suggested by the MS "Best Practices" page at
    >

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnmitta/html/bestpractaui.asp):
    >
    > If Not (Page.IsPostBack) Then
    > If (Device.IsMobileDevice) Then
    > RedirectToMobilePage("mobile/m_default.aspx")
    > Else
    > Response.Redirect("default.aspx")
    > End If
    > End If
    >
    > It used to work just fine, but now "Device.IsMobileDevice" also returns
    > false.
    >
    > Does anybody in this group have a clue why this is happening?
    >
    > Also, why is has MS not released another device update? The latest one is
    > over a year old.
    >
    > Thanks,
    >
    > Sacha
    >
    >
     
    Alex Homer, Dec 22, 2004
    #2
    1. Advertising

  3. Sacha Korell

    Sacha Korell Guest

    That's exactly what I'm doing in my current code. Here's the whole
    code-behind:

    Public Class check_device
    Inherits System.Web.UI.MobileControls.MobilePage
    Protected WithEvents Form1 As System.Web.UI.MobileControls.Form

    #Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub
    InitializeComponent()

    End Sub

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles MyBase.Init
    'CODEGEN: This method call is required by the Web Form Designer
    'Do not modify it using the code editor.
    InitializeComponent()
    End Sub

    #End Region

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles MyBase.Load
    'Put user code to initialize the page here

    Dim objCapabilities As System.Web.Mobile.MobileCapabilities

    objCapabilities = CType(Request.Browser,
    System.Web.Mobile.MobileCapabilities)

    If objCapabilities.IsMobileDevice Then
    'Redirect to mobile page
    Response.Write("Mobile Device")
    Else
    'Redirect to regular web app
    Response.Write("Not a Mobile Device")
    End If

    End Sub

    End Class

    This code produces the Response.Write("Not a Mobile Device") when I hit it
    with a "Windows Mobile 2003" device. However, when I connect with a "Windows
    Mobile 2002" device, it does produce the desired output.

    Do you think it might have something to do with server or config settings?

    Thanks,

    Sacha



    "Alex Homer" <> wrote in message
    news:...
    > IsMobileDevice is a property of the MobileCapabilities class. You need to
    > inherit the MobilePage and cast the Request.Browser instance to a
    > MobileCapabilities instance:
    >
    > <%@ Page Inherits="System.Web.UI.MobileControls.MobilePage"
    > Language="whatever" %>
    > <%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls"
    > Assembly="System.Web.Mobile" %>
    >
    > MobileCapabilities currentCapabilities =
    > (MobileCapabilities)Request.Browser;
    > result = currentCapabilities.IsMobileDevice;
    >
    >
    > "Sacha Korell" <> wrote in message
    > news:...
    >> First of all, sorry for cross-posting, but this newsgroup is much busier
    >> than "aspnet.mobile".
    >>
    >> I'm trying to create a portal page that redirects depending on the device
    >> that is connecting.
    >>
    >> When I use Request.Browser("IsMobileDevice"), it returns false when
    >> connecting with my iPAQ
    >> 2215 (and other Windows Mobile 2003 devices), although
    >> HTTPBrowserCapabilities "Platform" returns "WinCE".
    >>
    >> What's going on? I'm using VS.NET2003 for development with DeviceUpdate4
    >> installed.
    >>
    >> I had a code snippet like (suggested by the MS "Best Practices" page at
    >>

    > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnmitta/html/bestpractaui.asp):
    >>
    >> If Not (Page.IsPostBack) Then
    >> If (Device.IsMobileDevice) Then
    >> RedirectToMobilePage("mobile/m_default.aspx")
    >> Else
    >> Response.Redirect("default.aspx")
    >> End If
    >> End If
    >>
    >> It used to work just fine, but now "Device.IsMobileDevice" also returns
    >> false.
    >>
    >> Does anybody in this group have a clue why this is happening?
    >>
    >> Also, why is has MS not released another device update? The latest one is
    >> over a year old.
    >>
    >> Thanks,
    >>
    >> Sacha
    >>
    >>

    >
    >
     
    Sacha Korell, Dec 22, 2004
    #3
  4. Sacha Korell

    bruce barker Guest

    write a test page that displays

    Page.Request.ServerVariables["HTTP_USER_AGENT"]

    then in the machine.config file update the browsercaps section to support
    your iPAQ's useragent string.

    -- bruce (sqlwork.com)


    "Sacha Korell" <> wrote in message
    news:...
    | First of all, sorry for cross-posting, but this newsgroup is much busier
    | than "aspnet.mobile".
    |
    | I'm trying to create a portal page that redirects depending on the device
    | that is connecting.
    |
    | When I use Request.Browser("IsMobileDevice"), it returns false when
    | connecting with my iPAQ
    | 2215 (and other Windows Mobile 2003 devices), although
    | HTTPBrowserCapabilities "Platform" returns "WinCE".
    |
    | What's going on? I'm using VS.NET2003 for development with DeviceUpdate4
    | installed.
    |
    | I had a code snippet like (suggested by the MS "Best Practices" page at
    |
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnmitta/html/bestpractaui.asp):
    |
    | If Not (Page.IsPostBack) Then
    | If (Device.IsMobileDevice) Then
    | RedirectToMobilePage("mobile/m_default.aspx")
    | Else
    | Response.Redirect("default.aspx")
    | End If
    | End If
    |
    | It used to work just fine, but now "Device.IsMobileDevice" also returns
    | false.
    |
    | Does anybody in this group have a clue why this is happening?
    |
    | Also, why is has MS not released another device update? The latest one is
    | over a year old.
    |
    | Thanks,
    |
    | Sacha
    |
    |
     
    bruce barker, Dec 22, 2004
    #4
  5. Sacha Korell

    Sacha Korell Guest

    Thanks Bruce, I'll try that. I just thought it should be much easier than
    having to hack the machine.config for every new PDA device/OS version. What
    happened to device updates from Microsoft?

    Sacha



    "bruce barker" <> wrote in message
    news:%...
    > write a test page that displays
    >
    > Page.Request.ServerVariables["HTTP_USER_AGENT"]
    >
    > then in the machine.config file update the browsercaps section to support
    > your iPAQ's useragent string.
    >
    > -- bruce (sqlwork.com)
    >
    >
    > "Sacha Korell" <> wrote in message
    > news:...
    > | First of all, sorry for cross-posting, but this newsgroup is much busier
    > | than "aspnet.mobile".
    > |
    > | I'm trying to create a portal page that redirects depending on the
    > device
    > | that is connecting.
    > |
    > | When I use Request.Browser("IsMobileDevice"), it returns false when
    > | connecting with my iPAQ
    > | 2215 (and other Windows Mobile 2003 devices), although
    > | HTTPBrowserCapabilities "Platform" returns "WinCE".
    > |
    > | What's going on? I'm using VS.NET2003 for development with DeviceUpdate4
    > | installed.
    > |
    > | I had a code snippet like (suggested by the MS "Best Practices" page at
    > |
    > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnmitta/html/bestpractaui.asp):
    > |
    > | If Not (Page.IsPostBack) Then
    > | If (Device.IsMobileDevice) Then
    > | RedirectToMobilePage("mobile/m_default.aspx")
    > | Else
    > | Response.Redirect("default.aspx")
    > | End If
    > | End If
    > |
    > | It used to work just fine, but now "Device.IsMobileDevice" also returns
    > | false.
    > |
    > | Does anybody in this group have a clue why this is happening?
    > |
    > | Also, why is has MS not released another device update? The latest one
    > is
    > | over a year old.
    > |
    > | Thanks,
    > |
    > | Sacha
    > |
    > |
    >
    >
     
    Sacha Korell, Dec 23, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?am9obmxjb3g=?=

    dell axim and IsMobileDevice

    =?Utf-8?B?am9obmxjb3g=?=, Jun 8, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    411
    bruce barker
    Jun 8, 2004
  2. DJ
    Replies:
    3
    Views:
    983
  3. Frederik Delacourt

    IsMobileDevice false on PocketPC 2003

    Frederik Delacourt, Feb 10, 2004, in forum: ASP .Net Mobile
    Replies:
    1
    Views:
    159
    Vladislav Tihonyuk
    Feb 11, 2004
  4. Sacha Korell
    Replies:
    3
    Views:
    305
    Sean Feldman
    Jan 7, 2005
  5. Iñaki Baz Castillo
    Replies:
    9
    Views:
    211
    Igor Pirnovar
    Feb 26, 2009
Loading...

Share This Page