Click here to Skip to main content
12,761,216 members (29,920 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# ASP.NET

i have created 2 websites. 1> for pc. and 1> for mobile.

how to redirect a website if someone open from mobile devise. it should open a website of mobile.

and someone open from PC. it should open a website of PC.

Please Help.
Posted 20-Feb-13 21:23pm
NaVeN Kumar 21-Feb-13 2:25am
Can you please elaborate your question...!
harshadptl4 21-Feb-13 2:29am
if i tries to open my website from PC. it should open - (EXAMPLE).

and if i tries to open my website from Mobile devise. it should open - (EXAMPLE).


1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You can check the Request.Browser.IsMobileDevice property: MSDN[^] which should do it, but I wouldn't just do it - sometimes you want a mobile version on a PC (to cut out the crap and get to the meat of the webpage) and sometimes you want a PC version on your mobile (because the info isn't easily or obviously available on the mobile version)

The way this site does it is nice - there is a "mobile" link at the bottom which lets me override it, and a "Full Site" link at teh top of the mobile page to get back to PC. Perhaps, if you detect a mobile and ask which they prefer, and store the result in a cookie?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170217.1 | Last Updated 21 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100