Click here to Skip to main content
13,895,755 members
Click here to Skip to main content
Add your own
alternative version

Tagged as


3 bookmarked
Posted 27 Oct 2011
Licenced CPOL

ASP.NET Mobile Device Detection with Additional Methods

, 30 Oct 2011
Rate this:
Please Sign up or sign in to vote.
ASP.NET Mobile Device Detection with Additional Methods


In ASP.NET, you can easily detect the mobile device request using Request.Browser.IsMobileDevice  property and Request.UserAgent.But these functionalities don't work all the time, so to get the more appropriate results for the mobile detection and want to get more details about the mobile, the WURFL.dll is more useful.


Some of the popular mobile devices/browsers won’t be detected using this way because ASP.NET browser files are not supported in Opera Mobile or Android devices. That means if you want to classify the desktop page and mobile page, it won't helps you out.

Using the Code

  1. Add the WURFL.dll reference to your project.
  2. Copy the App_Data files to your project App_Data folder.
  3. Copy & Paste the WurflLoader.cs file to your App_Code folder.
  4. Build the project and now you can try the sample page WebForm1.aspx in browser.

	// The sample Method to check weather the device is a mobile and not a tablet.
public static Boolean isMobile()
   var device = WurflLoader.GetManager().GetDeviceForRequest(HttpContext.Current.Request);
   if (Convert.ToBoolean(device.GetCapability("is_wireless_device")) && !Convert.ToBoolean(device.GetCapability("is_tablet")))
     return true;
     return false;

Points of Interest

If there is a need of mobile browser detection and classification of mobiles needed, then this will be very useful. This is an open standard DLL.


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


About the Author

You may also be interested in...

Comments and Discussions

QuestionIS this Open Licence? Pin
sachinDabas8-Apr-14 19:33
membersachinDabas8-Apr-14 19:33 
SuggestionDevice detection in multiple languages. Pin
JMatthewson18-Sep-12 4:10
memberJMatthewson18-Sep-12 4:10 
SuggestionThis is NOT a one stop solution!! Pin
D Becker3-Nov-11 4:03
memberD Becker3-Nov-11 4:03 
GeneralRe: This is NOT a one stop solution!! Pin
Manoj Kumar Kota3-Nov-11 20:27
memberManoj Kumar Kota3-Nov-11 20:27 
GeneralRe: This is NOT a one stop solution!! Pin
D Becker3-Nov-11 23:22
memberD Becker3-Nov-11 23:22 
QuestionWURFL is not so open anymore Pin
Doug Domeny2-Nov-11 5:13
professionalDoug Domeny2-Nov-11 5:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web04 | 2.8.190306.1 | Last Updated 30 Oct 2011
Article Copyright 2011 by Manoj Kumar Kota
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid