By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,760 Members | 969 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,760 IT Pros & Developers. It's quick & easy.

IsMobileDevice returns false when connecting with WM 2003

P: n/a
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/de...practaui.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
Nov 19 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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" <ko****@huntsville.sparta.com> wrote in message
news:uA**************@TK2MSFTNGP11.phx.gbl...
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/de...practaui.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

Nov 19 '05 #2

P: n/a
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" <al**@stonebroom.com> wrote in message
news:ul**************@TK2MSFTNGP14.phx.gbl...
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" <ko****@huntsville.sparta.com> wrote in message
news:uA**************@TK2MSFTNGP11.phx.gbl...
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/de...practaui.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


Nov 19 '05 #3

P: n/a
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" <ko****@huntsville.sparta.com> wrote in message
news:uA**************@TK2MSFTNGP11.phx.gbl...
| 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/de...practaui.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
|
|
Nov 19 '05 #4

P: n/a
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" <no***********@safeco.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
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" <ko****@huntsville.sparta.com> wrote in message
news:uA**************@TK2MSFTNGP11.phx.gbl...
| 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/de...practaui.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
|
|

Nov 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.