Hello
I have a code that will detect if the are a iphone or not.
private static string ua = HttpContext.Current.Request.UserAgent.ToLower();
public static bool UserAgentiPhone()
{
if (ua.Contains("iphone") || ua.Contains("ipod"))
{
return true;
}
return false;
}
I have this in my application_start in global.asax
if (Mobile.UserAgentiPhone() == true)
{
Mobile.RewriteiPhone(Context);
}
and this in my custom url rewriter
else if (Mobile.Mobile.UserAgentiPhone() == true)
{
Mobile.Mobile.RewriteiPhone(context);
return;
}
RewriteiPhone: public static void RewriteiPhone(HttpContext context) { context.RewritePath("~/UI/Web/Mobile/iPhone/Default.aspx", false); }
When i build the source and test it, this work fine the first time. but it don't work the second time because it's jump or something so the aren't a iphone just only a normaly web.
I can't fine anything when i debbug because the source is being rebuild then any it will work...