views:

470

answers:

1

I'd like to detect a mobile user agent and redirect them when the session starts in a classic ASP app. Does anyone know a good way to pull this off?

+2  A: 

Take a look at:

http://mobiforge.com/developing/story/lightweight-device-detection-asp

sub is_mobile()
  Dim Regex, match
  Set Regex = New RegExp
     With Regex
        .Pattern = "(up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone|windows ce|pda|mobile|mini|palm|ipad)"
        .IgnoreCase = True
        .Global = True
      End With
   match = Regex.test(Request.ServerVariables("HTTP_USER_AGENT"))
   If match
      return True
   Else
      return False
   End If
End Sub

*Disclaimer: the code may not work, as I have no method to test it and little knowleage of classic ASP.

CodeJoust