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