Last post Feb 18, 2007 02:18 PM by jameshill
Jan 26, 2007 10:21 AM|jameshill|LINK
What if someone accesses my mobile page via a pc based browser. I'm would like to display a different layout and content for pc based browsers.
I have an idea that it may have something to do with browser detection, but unsure on how to implement this.
Anybody have a link to a good website that has information on this.
Jan 26, 2007 03:30 PM|awj|LINK
If you want to be able to distinguish between mobile (micro) browsers and desktop browsers the one way is to examine which client requests are telling you that they can accept WML - desktop browsers won't accept this but all micro-browsers can.
This information is available from the HTTP_ACCEPT section of the HTTP header. Take a look at this page (http://aspnet.asp101.com/samples/servvars.aspx) and you'll see the various pieces of info that the HTTP header consists of.
I found an example of scanning the HTTP request for the accepted types here (http://www.smackthemouse.com/xhtmlxml#h2-2 - about halfway down the page you'll see some C# code).
To start off I would suggest that you develop a page that simply displays all the components of the HTTP header (such as displayed in the first link above) and place it on a mobile webform so that you can view this page in both micro and desktop browsers,
noting the difference in the accepted types as declared in the HTTP_ACCEPT flag. You can then modify the code in the second link to parse a request and determine whether it's from a micro browser or not.
Of course, a simpler way is to place the HTTP header into a string and then check whether "WML" exists in the string (if the location of "WML" is > 0).
Hope that's of use to you,
Feb 12, 2007 12:39 AM|colinbo|LINK
Check out Redirecting to an ASP.NET Mobile Web Page.
Feb 18, 2007 02:18 PM|jameshill|LINK
Thats what I'v been looking for.. Nice Once