I want to use my .cs codebehind, either Page_PreInit or Page_Load to detect mobile browser and to redirect. I ran across this:
protected void Page_PreInit(object sender, EventArgs e)
{
if (Request.Browser.IsMobileDevice)
{
{
Response.Redirect("~/default_mobile.aspx");
}
}
}
It doesn't appear to work. Can someone suggest a correction? Also, do you know of an example of NOT redirecting, but merely replacing an element on the .aspx page with another (i.e; replacing a Silverlight movie with a still image for an iOS device.)