Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Closed Thread
Detecting and redirecting mobiles using ASP
Old 08-26-2010, 07:31 AM Detecting and redirecting mobiles using ASP
35173's Avatar
Average Talker

Posts: 21
Name: KD
Trades: 0
Hi

I was just wondering if anyone had any suggestions for detecting mobile devices and automatically redirecting them to a mobile site using asp please?

Many thanks in advance

35173
35173 is offline
View Public Profile
 
 
Register now for full access!
Old 08-27-2010, 03:44 AM Re: Detecting and redirecting mobiles using ASP
iamscottj's Avatar
Novice Talker

Posts: 7
Name: Scott John
Location: US
Trades: 0
Yes you can detect it by using the following code

Code:

if (Request.Browser["IsMobileDevice"] == "true" || Request.Browser["BlackBerry"] == "true" ) 
        {
            Response.Redirect("MobileDefault.aspx");
        }
        else 
        {
            Response.Redirect("DesktopDefault.aspx");
        }
iamscottj is offline
View Public Profile Visit iamscottj's homepage!
 
Old 08-28-2010, 02:13 PM Re: Detecting and redirecting mobiles using ASP
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,520
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
There is no request.browser in ASP, vBscript or Jscript. aspx pages are for .NET scripts and " || " is a C/C++/PHP syntax for OR

So basically your solution is not going to work for ASP.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
View Public Profile Visit chrishirst's homepage!
 
Old 08-28-2010, 02:18 PM Re: Detecting and redirecting mobiles using ASP
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,520
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
@35173 Are you using jScript or vBscript on the pages?
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
View Public Profile Visit chrishirst's homepage!
 
Old 08-30-2010, 02:56 PM Re: Detecting and redirecting mobiles using ASP
35173's Avatar
Average Talker

Posts: 21
Name: KD
Trades: 0
I'm using Jscript on my pages, but don't want to use Jscript in the mobile detection due to the fact that many mobile browsers won't have javascript enabled
35173 is offline
View Public Profile
 
Old 08-30-2010, 03:13 PM Re: Detecting and redirecting mobiles using ASP
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,520
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Jscript runs on the SERVER not the client.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
View Public Profile Visit chrishirst's homepage!
 
Old 08-31-2010, 05:53 AM Re: Detecting and redirecting mobiles using ASP
35173's Avatar
Average Talker

Posts: 21
Name: KD
Trades: 0
Ok thanks for that tip.. So... do you have a suggestion?
35173 is offline
View Public Profile
 
Old 09-04-2010, 06:40 PM Re: Detecting and redirecting mobiles using ASP
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,520
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Use the request.servervariables collection and read the value for HTTP_USERAGENT key to see if it contains a known mobile device

http://www.useragentstring.com/
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
View Public Profile Visit chrishirst's homepage!
 
Closed Thread     « Reply to Detecting and redirecting mobiles using ASP
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.80741 seconds with 12 queries