I've been using this code for ASP pages:
Code:
<%
' This specifically tests for Pocket IE on Pocket PC 2002 by searching for the "PPC" string within
' the User Agent field. "PPC" is only inclued in the USER AGENT header field on Pocket PC 2002.
userAgent = Request.ServerVariables("HTTP_USER_AGENT")
isPocketPc = false
' This check to see if the browser is any version of MSIE on Windows CE. That way, if the browser
' gets updated, this should still detect that it is from a Windows CE machine.
if(userAgent <> "" AND (InStr(userAgent, "PPC") > 0)) then
isPocketPc = true
end if
if isPocketPc then
' If the user is connecting with a pocket pc, then we redirect them to another page.
response.redirect("mobile/index.htm")
end if
%>