Examples of using Mobile Device Browser File for redirect

Aug 3, 2010 at 2:47 PM
Edited Aug 3, 2010 at 2:48 PM

Does anyone have working examples of using the Mobile Device Browser File to create a website redirect to a mobile website? I've tried to take what's here and make this work, but I just haven't had much luck. I'm working in VB.

Thanks in advance,
Nathan Webster 

Dec 14, 2010 at 6:54 PM

Hello

Instead of using MDBF please use http://51degrees.codeplex.com/. It is an ASP.NET open source module  which detects mobile devices and provides auto redirection to mobile optimized pages when request is coming from mobile device. It makes use of WURFL mobile device database. For redirection there is no need to modify existing ASP.NET web application pages.

Below is sample web.config settings to show how easy it is to implement mobile detection and rediection without modifying any of your existing asp.net web pages.

In this example MobileDeviceManufacturer is used as the property. This properties are exposed through the HttpRequest classes Browser property. Both WURFL capabilities and ASP.NET Browser properties can be used with the property attribute. If none of the <locations> match and the requesting device is a mobile device then the mobileHomePageUrl will be used.

<redirect firstRequestOnly="true"
mobileHomePageUrl="~/Mobile/Default.aspx"
timeout="20"
devicesFile="~/App_Data/Devices.dat"
mobilePagesRegex="/[Apple|RIM|Nokia|Mobile]/">
<locations>
<!--Send iphone to their own home page.-->
<location url="~/Apple/Default.aspx">
<add property="MobileDeviceManufacturer" matchExpression="Apple"/>
</location>
<!--Send blackberry to their own home page.-->
<location url="~/RIM/Default.aspx">
<add property="MobileDeviceManufacturer" matchExpression="RIM"/>
</location>
<!--Send nokia to their own home page.-->
<location url="~/Nokia/Default.aspx">
<add property="MobileDeviceManufacturer" matchExpression="Nokia"/>
</location>
</locations>
</redirect>