On my main login screen, i am checking to see if the browser is a mobile browser. If the browser is a mobile browser i redirect the user to the mobile website login screen. This works fine on my Android device but not on my Iphone. I went and tried putting in Response.End() after my redirects but that caused my Android device to start getting the error message. The message i am getting on both devices is that there are to many server redirects. Any Hints?
Edit:
if (Request.Headers["User-Agent"] != null && (Request.Browser["IsMobileDevice"] == "true"
|| Request.UserAgent.ToUpper().Contains("MIDP") || Request.UserAgent.ToUpper().Contains("CLDC")
|| Request.UserAgent.ToLower().Contains("iphone") || Request.UserAgent.ToLower().Contains("avant")
|| Request.UserAgent开发者_运维百科.ToLower().Contains("nokia") || Request.UserAgent.ToLower().Contains("pda")
|| Request.UserAgent.ToLower().Contains("moto") || Request.UserAgent.ToLower().Contains("windows ce")
|| Request.UserAgent.ToLower().Contains("hand") || Request.UserAgent.ToLower().Contains("mobi")
|| Request.UserAgent.ToUpper().Contains("HTC") || Request.UserAgent.ToLower().Contains("sony")
|| Request.UserAgent.ToLower().Contains("panasonic") || Request.UserAgent.ToLower().Contains("blackberry")
|| Request.UserAgent.ToLower().Contains("240x320") || Request.UserAgent.ToLower().Contains("voda"))
|| Request.UserAgent.ToLower().Contains("android") || Request.UserAgent.ToLower().Contains("ipad"))
{
Response.Redirect("~/Mobile/Login.aspx");
}
Check event viewer logs on the server. Might also want to try doing Response.Redirect(urlString, false);
Response.Redirect(urlString); does a Response.End() inside and can cause issues with threads aborting. This is expected and not a big deal but it will throw as an exception.
精彩评论