Redirecting to a Mobile Site

Aug 24, 2009 at 4:46 PM
Edited Aug 24, 2009 at 6:37 PM

***********SOLVED************

I found it The answer to this post...

Response.Redirect();

******************************

Hello,

I have an HTML site and I want a mobile device, when hitting my site to go to the mobile site(Ex. Instead of Google.com, on a mobile device it would go to Google.com/m).

I have tried to just make an ASP .NET project and put in the Page_Load method:

 

if (Request.Browser.IsMobileDevice)
{
       //??????
}

 

I have no idea if it is this easy or not... I also don't know how to cause a redirect from the url they gave to the url of the mobile site.

Thanks for any help.

 

Dec 14, 2010 at 5:59 PM

Hello

Please take a look at 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.

<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>


 

Jan 9, 2011 at 6:30 AM

USE ASP.NET MVC