Click here to Skip to main content
12,355,505 members (70,849 online)
Click here to Skip to main content
Articles » Web Development » ASP.NET » General » Downloads

Stats

467.1K views
6K downloads
186 bookmarked
Posted

Browser Detection using ASP.NET

, 6 May 2009 CPOL
Using and updating your machine.config file to better detect browser type in ASP.NET
using System;
using NUnit.Framework;

namespace Ocean.Nunit.HttpCapabilities
{
	/// <summary>
	/// Summary description for Class1.
	/// </summary>
	[TestFixture]
	public class CapabiltiesMobile
	{
		Ocean.Web.HttpCapabilities.Settings Mobile;
		public CapabiltiesMobile()
		{
			Mobile = new Ocean.Web.HttpCapabilities.Settings(Ocean.Web.HttpCapabilities.EmbededFile.MobileCap);
			/*

AU-MIC/1.1.4.0 20722 MMP/2.0
LGE-CX5450 UP.Browser/6.2.2.3.d.1.103 (GUI) MMP/2.0
Mozilla/1.22 (compatible; MSIE 5.01; PalmOS 3.0) EudoraWeb 2.1
Mozilla/2.0 (compatible; Elaine/3.0)
Mozilla/2.0 (compatible; MSIE 3.02; Windows CE; Smartphone; 176x220)
Mozilla/4.0 (compatible; MSIE 4.0; SmartPhone; Symbian OS/1.1.0) Netfront/3.1
Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; MSN Companion 2.0; 800x600; Compaq)
Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; PPC; 240x320)
Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; Smartphone; 176x220)
Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; Smartphone; 176x220; SPV C500; OpVer 4.1.3.0)
Mozilla/4.0 (compatible; MSIE 5.0; Linux 2.4.18-rmk7-pxa3-embedix armv5tel; 480x640) Opera 6.0 [en]
Mozilla/4.0 (compatible; MSIE 6.0; j2me) ReqwirelessWeb/3.5
Mozilla/4.0 (compatible; MSIE 6.0; Windows 95; PalmSource; Blazer 3.0) 16;160x160
Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; PalmSource/hspr-H102; Blazer/4.0) 16;320x320
Mozilla/4.0 (compatible;MSIE 6.0;Windows95;PalmSource) Netfront/3.0;8;320x320
Mozilla/4.0 (PDA; Windows CE/0.9.3) NetFront/3.0
Mozilla/4.1 (compatible; MSIE 5.0; Symbian OS; Nokia 6600;452) Opera 6.20 [en-US]
Mozilla/4.1 (compatible; MSIE5.0; Symbian OS); Opera 6.02 [de]
Mozilla/4.74 [en] (X11; I; ProxiNet)
Mozilla/4.76 [en] (PalmOS; U; WebPro/3.0.1a; Palm-Cct1)
Mozilla/5.0+(compatible;+AvantGo+3.2;+ProxiNet;+Danger+hiptop+1.0)
NokiaN-Gage/1.0 SymbianOS/6.1 Series60/1.2 Profile/MIDP-1.0 Configuration/CLDC-1.0
portalmmm/2.0 N410i(c20;TB)
ReqwirelessWeb/3.2 S55
SEC-SGHD410
UPG1 UP/4.0 (compatible; Blazer 1.0)

			*/
		}
		[Test]
		public void	Test_BlackBerry()
		{
			Ocean.Web.HttpCapabilities.Result R;

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Mobile.Process("BlackBerry/3.6.0");
			Assert.AreEqual("BlackBerry",R.Browser, "Browser Name Compare");
			Assert.AreEqual("3.6.0",R.Version, "Browser Version Compare");
			Assert.AreEqual("3",R["majorversion"], "Browser Major Version Compare");
			Assert.AreEqual("6",R["minorVersion"], "Browser minor Version Compare");
			Assert.AreEqual(true,R.isMobileDevice, "isMobileDevice Compare");

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Mobile.Process("BlackBerry7230/3.7.0");
			Assert.AreEqual("BlackBerry",R.Browser, "Browser Name Compare");
			Assert.AreEqual("3.7.0",R.Version, "Browser Version Compare");
			Assert.AreEqual("3",R["majorversion"], "Browser Major Version Compare");
			Assert.AreEqual("7",R["minorVersion"], "Browser minor Version Compare");
			Assert.AreEqual("BlackBerry 7230",R["type"], "type"); 
			Assert.AreEqual("7230",R.MobileDeviceModel, "MobileDeviceModel");
			Assert.AreEqual(true,R.isMobileDevice, "isMobileDevice Compare");

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Mobile.Process("BlackBerry7230/3.7.1");
			Assert.AreEqual("BlackBerry",R.Browser, "Browser Name Compare");
			Assert.AreEqual("3.7.1",R.Version, "Browser Version Compare");
			Assert.AreEqual("3",R["majorversion"], "Browser Major Version Compare");
			Assert.AreEqual("7",R["minorVersion"], "Browser minor Version Compare");
			Assert.AreEqual("BlackBerry 7230",R["type"], "type");
			Assert.AreEqual("7230",R.MobileDeviceModel, "MobileDeviceModel");
			Assert.AreEqual(true,R.isMobileDevice, "isMobileDevice Compare");
		
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Mobile.Process("BlackBerry7730/3.7.0");
			Assert.AreEqual("BlackBerry",R.Browser, "Browser Name Compare");
			Assert.AreEqual("3.7.0",R.Version, "Browser Version Compare");
			Assert.AreEqual("3",R["majorversion"], "Browser Major Version Compare");
			Assert.AreEqual("7",R["minorVersion"], "Browser minor Version Compare");
			Assert.AreEqual("BlackBerry 7730",R["type"], "type");
			Assert.AreEqual("7730",R.MobileDeviceModel, "MobileDeviceModel");
			Assert.AreEqual(true,R.isMobileDevice, "isMobileDevice Compare");

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Mobile.Process("BlackBerry7730/3.7.1 UP.Link/5.1.2.5");
			Assert.AreEqual("BlackBerry",R.Browser, "Browser Name Compare");
			Assert.AreEqual("3.7.1",R.Version, "Browser Version Compare");
			Assert.AreEqual("3",R["majorversion"], "Browser Major Version Compare");
			Assert.AreEqual("7",R["minorVersion"], "Browser minor Version Compare");
			Assert.AreEqual("BlackBerry 7730",R["type"], "type");
			Assert.AreEqual("7730",R.MobileDeviceModel, "MobileDeviceModel");
			Assert.AreEqual(true,R.isMobileDevice, "isMobileDevice Compare");

		}
		[Test]
		public void Test_Gateway()
		{
			Ocean.Web.HttpCapabilities.Result R;
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Mobile.Process("MOT-1.2.0/11.03 UP.Browser/4.1.27a UP.Link/4.3.2 (Google WAP Proxy/1.0)");
			Assert.AreEqual("UP.Link/4.3.2",R["gatewayVersion"], "Browser Name Compare");
			Assert.AreEqual("4",R["gatewayMajorVersion"], "Browser Name Compare");
			Assert.AreEqual(".3",R["gatewayMinorVersion"], "Browser Name Compare");
			Assert.AreEqual(".2",R["gatewayRevisionVersion"], "Browser Name Compare");
			
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Mobile.Process("MOT-A-0A/00.04 UP.Browser/4.1.27a1 UP.Link/4.2.3.5c");
			Assert.AreEqual("UP.Link/4.2.3.5c",R["gatewayVersion"], "Browser Name Compare");
			Assert.AreEqual("4",R["gatewayMajorVersion"], "Browser Name Compare");
			Assert.AreEqual(".2",R["gatewayMinorVersion"], "Browser Name Compare");
			Assert.AreEqual(".3",R["gatewayRevisionVersion"], "Browser Name Compare");

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Mobile.Process("MOT-A-0A/00.06 UP.Browser/4.1.27a1 UP.Link/4.2.3.5c");
			Assert.AreEqual("UP.Link/4.2.3.5c",R["gatewayVersion"], "Browser Name Compare");
			Assert.AreEqual("4",R["gatewayMajorVersion"], "Browser Name Compare");
			Assert.AreEqual(".2",R["gatewayMinorVersion"], "Browser Name Compare");
			Assert.AreEqual(".3",R["gatewayRevisionVersion"], "Browser Name Compare");

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Mobile.Process("MOT-A-0A/00.06 UP.Browser/4.1.27a1 UP.Link/4.2.3.5h");
			Assert.AreEqual("UP.Link/4.2.3.5h",R["gatewayVersion"], "Browser Name Compare");
			Assert.AreEqual("4",R["gatewayMajorVersion"], "Browser Name Compare");
			Assert.AreEqual(".2",R["gatewayMinorVersion"], "Browser Name Compare");
			Assert.AreEqual(".3",R["gatewayRevisionVersion"], "Browser Name Compare");
			
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Mobile.Process("MOT-MCCB/7582 UP.Browser/4.1.23 UP.Link/4.2.1.1");
			Assert.AreEqual("UP.Link/4.2.1.1",R["gatewayVersion"], "Browser Name Compare");
			Assert.AreEqual("4",R["gatewayMajorVersion"], "Browser Name Compare");
			Assert.AreEqual(".2",R["gatewayMinorVersion"], "Browser Name Compare");
			Assert.AreEqual(".1",R["gatewayRevisionVersion"], "Browser Name Compare");
			
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Mobile.Process("MOT-SAP4_/11.03 UP.Browser/4.1.23c UP.Link/5.1.1.2a");
			Assert.AreEqual("UP.Link/5.1.1.2a",R["gatewayVersion"], "Browser Name Compare");
			Assert.AreEqual("5",R["gatewayMajorVersion"], "Browser Name Compare");
			Assert.AreEqual(".1",R["gatewayMinorVersion"], "Browser Name Compare");
			Assert.AreEqual(".1",R["gatewayRevisionVersion"], "Browser Name Compare");
		
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------			
			R = Mobile.Process("MOT-61/04.02 UP/4.1.17r UP.Browser/4.1.17r-XXXX UP.Link/4.2.3.5h (Google WAP Proxy/1.0)");   
			Assert.AreEqual("UP.Link/4.2.3.5h",R["gatewayVersion"], "Browser Name Compare");
			Assert.AreEqual("4",R["gatewayMajorVersion"], "Browser Name Compare");
			Assert.AreEqual(".2",R["gatewayMinorVersion"], "Browser Name Compare");
			Assert.AreEqual(".3",R["gatewayRevisionVersion"], "Browser Name Compare");
					
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Mobile.Process("MOT-V220/0B.D1.1BR MIB/2.2.1 Profile/MIDP-2.0 Configuration/CLDC-1.0 UP.Link/1.1 (Google WAP Proxy/1.0)");  
			Assert.AreEqual("UP.Link/1.1",R["gatewayVersion"], "Browser Name Compare");
			Assert.AreEqual("1",R["gatewayMajorVersion"], "Browser Name Compare");
			Assert.AreEqual(".1",R["gatewayMinorVersion"], "Browser Name Compare");
			Assert.AreEqual("0",R["gatewayRevisionVersion"], "Browser Name Compare");

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Mobile.Process("SonyEricssonT630/R401 Profile/MIDP-1.0 Configuration/CLDC-1.0 UP.Link/5.1.1.4");
			Assert.AreEqual("UP.Link/5.1.1.4",R["gatewayVersion"], "Browser Name Compare");
			Assert.AreEqual("5",R["gatewayMajorVersion"], "Browser Name Compare");
			Assert.AreEqual(".1",R["gatewayMinorVersion"], "Browser Name Compare");
			Assert.AreEqual(".1",R["gatewayRevisionVersion"], "Browser Name Compare");
		}

		[Test]
		public void Test_DoCoMo()
		{
			Ocean.Web.HttpCapabilities.Result R;
			
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Mobile.Process("DoCoMo/1.0/D503iS/c10");
			Assert.AreEqual("i-mode",R.Browser, "Browser Name Compare");   
			Assert.AreEqual("0.0",R.Version, "Browser Version Compare");   
			Assert.AreEqual("Mitsubishi",R.MobileDeviceManufacturer, "Browser Version Compare"); 
			Assert.AreEqual("D503iS",R.MobileDeviceModel, "Browser Version Compare");  
			Assert.AreEqual(true,R.isMobileDevice, "isMobileDevice Compare");

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Mobile.Process("DoCoMo/1.0/N504i/c10/TB");
			Assert.AreEqual("i-mode",R.Browser, "Browser Name Compare");
			Assert.AreEqual("0.0",R.Version, "Browser Version Compare"); 
			Assert.AreEqual("NEC",R.MobileDeviceManufacturer, "Browser Version Compare");
			Assert.AreEqual("N504i",R.MobileDeviceModel, "Browser Version Compare");  
			Assert.AreEqual(true,R.isMobileDevice, "isMobileDevice Compare");

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Mobile.Process("DoCoMo/1.0/P504iS/c10/TB");
			Assert.AreEqual("i-mode",R.Browser, "Browser Name Compare");
			Assert.AreEqual("0.0",R.Version, "Browser Version Compare");
			Assert.AreEqual("Panasonic",R.MobileDeviceManufacturer, "Browser Version Compare");
			Assert.AreEqual("P504iS",R.MobileDeviceModel, "Browser Version Compare"); 
			Assert.AreEqual(true,R.isMobileDevice, "isMobileDevice Compare");
			
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Mobile.Process("DoCoMo/2.0 P900i(c100;TB;W24H11)");
			Assert.AreEqual("i-mode",R.Browser, "Browser Name Compare");
			Assert.AreEqual("0.0",R.Version, "Browser Version Compare");
			Assert.AreEqual("Panasonic",R.MobileDeviceManufacturer, "Browser Version Compare");
			Assert.AreEqual("P900i",R.MobileDeviceModel, "Browser Version Compare"); 
			Assert.AreEqual(true,R.isMobileDevice, "isMobileDevice Compare");	
			
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Mobile.Process("DoCoMo/1.0/P502i/c10 (Google CHTML Proxy/1.0)");   
			Assert.AreEqual("i-mode",R.Browser, "Browser Name Compare");   
			Assert.AreEqual("0.0",R.Version, "Browser Version Compare");   
			Assert.AreEqual("Panasonic",R.MobileDeviceManufacturer, "Browser Version Compare");   
			Assert.AreEqual("P502i",R.MobileDeviceModel, "Browser Version Compare"); 
			Assert.AreEqual(true,R.isMobileDevice, "isMobileDevice Compare");

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Mobile.Process("DoCoMo/2.0 SH900i(c100;TB;W24H12)");   
			Assert.AreEqual("i-mode",R.Browser, "Browser Name Compare");   
			Assert.AreEqual("0.0",R.Version, "Browser Version Compare");   
			Assert.AreEqual("Sharp",R.MobileDeviceManufacturer, "Browser Version Compare"); 
			Assert.AreEqual("SH900i",R.MobileDeviceModel, "Browser Version Compare");   
			Assert.AreEqual(true,R.isMobileDevice, "isMobileDevice Compare");
		}

		[Test]
		public void	Test_Misc()
		{
			Ocean.Web.HttpCapabilities.Result R;	

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Mobile.Process("Mozilla/4.1 (compatible; MSIE 5.0; Symbian OS) Opera 6.02  [de]");
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");
			Assert.AreEqual("6.02",R.Version, "Browser Version Compare");
			Assert.AreEqual("6",R["majorversion"], "Browser Major Version Compare");
			Assert.AreEqual(".02",R["minorVersion"], "Browser minor Version Compare");
			Console.WriteLine(R["isMobileDevice"]);
			Assert.AreEqual(true,R.isMobileDevice, "isMobileDevice Compare");
			
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Mobile.Process("Mozilla/4.1 (compatible; MSIE 5.0; Symbian OS) Opera 6.02  [en]");
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");
			Assert.AreEqual("6.02",R.Version, "Browser Version Compare");
			Assert.AreEqual("6",R["majorversion"], "Browser Major Version Compare");
			Assert.AreEqual(".02",R["minorVersion"], "Browser minor Version Compare");
			Assert.AreEqual(true,R.isMobileDevice, "isMobileDevice Compare");
			
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Mobile.Process("UP.Browser/3.04-SN17 UP.Link/3.4.5.6");
			Assert.AreEqual("Phone.com",R.Browser, "Browser Name Compare");
			Assert.AreEqual("3.04",R.Version, "Browser Version Compare");
			Assert.AreEqual(true,R.isMobileDevice, "isMobileDevice Compare");
			
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Mobile.Process("UP.Browser/3.1.04-DS15 UP.Link/5.0.2.9 (Google WAP Proxy/1.0)");
			Assert.AreEqual("Phone.com",R.Browser, "Browser Name Compare");
			Assert.AreEqual("3.1",R.Version, "Browser Version Compare");
			Assert.AreEqual(true,R.isMobileDevice, "isMobileDevice Compare");
			
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Mobile.Process("UP.Browser/6.1.0.1.140 (Google CHTML Proxy/1.0)");
			Assert.AreEqual("Phone.com",R.Browser, "Browser Name Compare");
			Assert.AreEqual("0.0",R.Version, "Browser Version Compare");
			Assert.AreEqual(true,R.isMobileDevice, "isMobileDevice Compare");
			
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Mobile.Process("AUDIOVOX-CDM9155SP/07.60 UP.Browser/4.1.26c3 UP.Link/5.0.2.8 (Google WAP Proxy/1.0)"); 
            Assert.AreEqual("Phone.com",R.Browser, "Browser Name Compare");   
			Assert.AreEqual("4.1",R.Version, "Browser Version Compare"); 
			Assert.AreEqual("Audiovox",R.MobileDeviceManufacturer, "Browser Version Compare");  
			Assert.AreEqual("CDM9155SP",R.MobileDeviceModel, "Browser Version Compare");  
			Assert.AreEqual(true,R.isMobileDevice, "isMobileDevice Compare");
			
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Mobile.Process("jBrowser (Google WAP Proxy/1.0)");  
			Assert.AreEqual("Jataayu jBrowser",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("0.0",R.Version, "Browser Version Compare");   
			Assert.AreEqual("Jataayu",R.MobileDeviceManufacturer, "MobileDeviceManufacturer");  
			Assert.AreEqual("jBrowser",R.MobileDeviceModel, "Browser Version Compare");  
			Assert.AreEqual(true,R.isMobileDevice, "isMobileDevice Compare");
			
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Mobile.Process("jBrowser/J2ME Profile/MIDP-1.0 Configuration/CLDC-1.0 (Google WAP Proxy/1.0)");  
			Assert.AreEqual("Jataayu jBrowser",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("0.0",R.Version, "Browser Version Compare");   
			Assert.AreEqual("Jataayu",R.MobileDeviceManufacturer, "MobileDeviceManufacturer");  
			Assert.AreEqual("jBrowser",R.MobileDeviceModel, "Browser Version Compare");  
			Assert.AreEqual(true,R.isMobileDevice, "isMobileDevice Compare");
					
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Mobile.Process("OPWV-SDK/62 UP.Browser/6.2.2.1.208 (GUI) MMP/2.0"); 
			Assert.AreEqual("Phone.com",R.Browser, "Browser Name Compare");   
			Assert.AreEqual("6.2",R.Version, "Browser Version Compare");   
			Assert.AreEqual("Openwave",R.MobileDeviceManufacturer, "Browser Version Compare");  
			Assert.AreEqual("Openwave 6.2 emulator",R.MobileDeviceModel, "Browser Version Compare");  
			Assert.AreEqual(true,R.isMobileDevice, "isMobileDevice Compare");
								
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Mobile.Process("SAGEM-myX-5/2.0 UP.Browser/5.0.3.3.1.c.1 (GUI) (Google WAP Proxy/1.0)"); 
			Assert.AreEqual("Phone.com",R.Browser, "Browser Name Compare");   
			Assert.AreEqual("5.0",R.Version, "Browser Version Compare");   
			Assert.AreEqual("Sagem",R.MobileDeviceManufacturer, "Browser Version Compare");  
			Assert.AreEqual("myX5-2",R.MobileDeviceModel, "Browser Version Compare");  
			Assert.AreEqual(true,R.isMobileDevice, "isMobileDevice Compare");
		}

		[Test]
		public void	Test_Sprint()
		{
			Ocean.Web.HttpCapabilities.Result R;	
					
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Mobile.Process("LGE-LG4600 UP.Browser/6.2.2.3.d.1.104 (GUI) MMP/2.0 (Google WAP Proxy/1.0)"); 
			Assert.AreEqual("Phone.com",R.Browser, "Browser Name Compare");   
			Assert.AreEqual("6.2",R.Version, "Browser Version Compare");   
			Assert.AreEqual("Sprint",R.MobileDeviceManufacturer, "Browser Version Compare");  
			Assert.AreEqual("LG4600",R.MobileDeviceModel, "Browser Version Compare");  
			Assert.AreEqual(true,R.isMobileDevice, "isMobileDevice Compare");

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Mobile.Process("LGE-AX5450 UP.Browser/4.1.27 UP.Link/4.2.1.1"); 
			Assert.AreEqual("Phone.com",R.Browser, "Browser Name Compare");   
			Assert.AreEqual("4.1",R.Version, "Browser Version Compare");   
			Assert.AreEqual("Sprint",R.MobileDeviceManufacturer, "Browser Version Compare");  
			Assert.AreEqual("AX5450",R.MobileDeviceModel, "Browser Version Compare");  
			Assert.AreEqual(true,R.isMobileDevice, "isMobileDevice Compare");
								
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Mobile.Process("LGE-LX5350/1.0 UP.Browser/6.1.0.2.135 (GUI) MMP/2.0"); 
			Assert.AreEqual("Phone.com",R.Browser, "Browser Name Compare");   
			Assert.AreEqual("6.1",R.Version, "Browser Version Compare");   
			Assert.AreEqual("Sprint",R.MobileDeviceManufacturer, "Browser Version Compare");  
			Assert.AreEqual("LX5350",R.MobileDeviceModel, "Browser Version Compare");  
			Assert.AreEqual(true,R.isMobileDevice, "isMobileDevice Compare");
								
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Mobile.Process("LGE-LX5350/4.0 UP.Browser/6.2.0.1.185 (GUI) MMP/2.0"); 
			Assert.AreEqual("Phone.com",R.Browser, "Browser Name Compare");   
			Assert.AreEqual("6.2",R.Version, "Browser Version Compare");   
			Assert.AreEqual("Sprint",R.MobileDeviceManufacturer, "Browser Version Compare");  
			Assert.AreEqual("LX5350",R.MobileDeviceModel, "Browser Version Compare");  
			Assert.AreEqual(true,R.isMobileDevice, "isMobileDevice Compare");

											
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Mobile.Process("LGE-TM520/1.0 UP.Browser/4.1.22b UP.Link/4.3.4.4d"); 
			Assert.AreEqual("Phone.com",R.Browser, "Browser Name Compare");   
			Assert.AreEqual("4.1",R.Version, "Browser Version Compare");   
			Assert.AreEqual("Sprint",R.MobileDeviceManufacturer, "Browser Version Compare");  
			Assert.AreEqual("TM520",R.MobileDeviceModel, "Browser Version Compare");  
			Assert.AreEqual(true,R.isMobileDevice, "isMobileDevice Compare");
		}
		[Test]
		public void Test_WinCE()
		{
			Ocean.Web.HttpCapabilities.Result R;	
					
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Mobile.Process("Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; PPC; 240x320; HP iPAQ h6300)"); 
			Assert.AreEqual("Pocket IE",R.Browser, "Browser Name Compare");   
			Assert.AreEqual("4.01",R.Version, "Browser Version Compare");   
			Assert.AreEqual("Pocket PC",R.MobileDeviceModel, "Browser Version Compare");  
			Assert.AreEqual(true,R.isMobileDevice, "isMobileDevice Compare");

			R = Mobile.Process("Mozilla/2.0 (compatible; MSIE 3.02; Windows CE; 240x320)"); 
			Assert.AreEqual("Pocket IE",R.Browser, "Browser Name Compare");   
			Assert.AreEqual("3.02",R.Version, "Browser Version Compare");   
			Assert.AreEqual("Pocket PC",R.MobileDeviceModel, "Browser Version Compare");  
			Assert.AreEqual(true,R.isMobileDevice, "isMobileDevice Compare");

			R = Mobile.Process("Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; PPC; 240x320)"); 
			Assert.AreEqual("Pocket IE",R.Browser, "Browser Name Compare");   
			Assert.AreEqual("4.01",R.Version, "Browser Version Compare");   
			Assert.AreEqual("Pocket PC",R.MobileDeviceModel, "Browser Version Compare");  
			Assert.AreEqual(true,R.isMobileDevice, "isMobileDevice Compare");

			R = Mobile.Process("Mozilla/4.0 (compatible; MSIE 4.01; Windows NT Windows CE)"); 
			Assert.AreEqual("Pocket IE",R.Browser, "Browser Name Compare");   
			Assert.AreEqual("4.01",R.Version, "Browser Version Compare");   
			Assert.AreEqual("Pocket PC",R.MobileDeviceModel, "Browser Version Compare");  
			Assert.AreEqual(true,R.isMobileDevice, "isMobileDevice Compare");

		}
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

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

Share

About the Author

Chris Maunder
Founder CodeProject
Canada Canada
Chris is the Co-founder, Administrator, Architect, Chief Editor and Shameless Hack who wrote and runs The Code Project. He's been programming since 1988 while pretending to be, in various guises, an astrophysicist, mathematician, physicist, hydrologist, geomorphologist, defence intelligence researcher and then, when all that got a bit rough on the nerves, a web developer. He is a Microsoft Visual C++ MVP both globally and for Canada locally.

His programming experience includes C/C++, C#, SQL, MFC, ASP, ASP.NET, and far, far too much FORTRAN. He has worked on PocketPCs, AIX mainframes, Sun workstations, and a CRAY YMP C90 behemoth but finds notebooks take up less desk space.

He dodges, he weaves, and he never gets enough sleep. He is kind to small animals.

Chris was born and bred in Australia but splits his time between Toronto and Melbourne, depending on the weather. For relaxation he is into road cycling, snowboarding, rock climbing, and storm chasing.

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160621.1 | Last Updated 6 May 2009
Article Copyright 2004 by Chris Maunder
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid