There are a number of solutions on the internet but the one I found to work, is here
51Degrees.mobi - Mobile Device Detection and Redirection
The is the code: I allow the user to click on a button that redirects back to the proper page, using PostURL with a Parameter
protected void Page_Load(object sender, EventArgs e)
{
string _strUserAgent = Request.UserAgent.ToString().ToLower();
if ((Request.Browser.IsMobileDevice == true) || _strUserAgent.Contains("iphone") || _strUserAgent.Contains("blackberry") || _strUserAgent.Contains("mobile") || _strUserAgent.Contains("windows ce") || _strUserAgent.Contains("opera mini") ||
_strUserAgent.Contains("palm"))
{
if (Request.Params["ForceStandard"] != "Y")
Response.Redirect("mobiProducts.aspx");
// show a status message
_strUserAgent = "mobile detected";
}
// update some status on the site for debug purposes, remove when live ...
ltrlUserStatus.Text = _strUserAgent;
}
51Degrees.mobi - Mobile Device Detection and Redirection
The is the code: I allow the user to click on a button that redirects back to the proper page, using PostURL with a Parameter
protected void Page_Load(object sender, EventArgs e)
{
string _strUserAgent = Request.UserAgent.ToString().ToLower();
if ((Request.Browser.IsMobileDevice == true) || _strUserAgent.Contains("iphone") || _strUserAgent.Contains("blackberry") || _strUserAgent.Contains("mobile") || _strUserAgent.Contains("windows ce") || _strUserAgent.Contains("opera mini") ||
_strUserAgent.Contains("palm"))
{
if (Request.Params["ForceStandard"] != "Y")
Response.Redirect("mobiProducts.aspx");
// show a status message
_strUserAgent = "mobile detected";
}
// update some status on the site for debug purposes, remove when live ...
ltrlUserStatus.Text = _strUserAgent;
}
Comments