ASP.NET Mobile Content

A few weeks ago before everything started getting really busy both personally and work wise, I still somehow found the time to put together a mobile version of my blog content.

Device Detection
In the beginning I was just using the ASP.NET property Request.Browser.IsMobileDevice for device detection, but for some reason WindowsCE is not considered a mobile device by this property, so I included an additional 'if Request.Browser.Platform.Equals("WinCE")'. The mobile devices request will be redirected to which displays only one post on the screen at a time using 100% mobile controls and pages.

While I was creating my Mobile Page, I found in the docs that in ASP.NET 1.1 the adaptive rendering for mobile devices was only done in the ASP.NET mobile controls. Apparently this has all been combined into the regular controls in .NET 2.0. My first thought was 'wow, thats great, my pages should be compatible with mobile devices without having to do a thing'. However after viewing my normal domain with an O2 Neo WindowsCE device there's just waaay to much content for the small screen.

This leads me to three possible solutions to dealing with mobile devices reading my blog.

  1. The first is simply; get an rss reader for your mobile device, you get none of the pretty style sheet nonsense since it probably won't display correctly anyway.
  2. Second is redirect the device to a different url which is specific to mobile screens.
  3. The third option is the one I'd like to explore a little more which is; assuming that the regular controls will use their super adaptive rendering powers on mobile screens, then simply change the masterpage to a 'mobile specific' version.

I would like to test the normal controls using a WAP only phone / browser just to make sure everything works the way it should before I fully move away from my 'Mobile Only' page for a masterpage.

Because my posts contain HTML formatting, this formatting may or may not be compatible on the target mobile device. The MobileLiteral control takes care of this by filtering out incompatible HTML tags, now to be specific, its easier to list the tags that it doesn't filter, even <hr> is gone. This is not so much as a problem as the <img> tag being filtered out of the posts. My original idea for this problem was to simply regex the post to extract the image links, then redirect all my images through my own 'ImageResizingHandler' which would then shrink the image on-the-fly to fit the width of the mobile screen if it was too big...but...because these tags a wiped out, this won't work...yet.

Well, my next steps are to test the rendering under a more primitive device then my O2 Neo. Somehow improve the mobile devices detection (even Opera Mobile slips through). Then assuming all that works I've only got the images problem to figure out.

General .NET SingleUserBlog
Posted by: Brendan Kowitz
Last revised: 21 Sep 2013 12:15PM


No comments yet. Be the first!

No new comments are allowed on this post.