Click here to Skip to main content
Click here to Skip to main content
Articles » Web Development » ASP.NET » General » Downloads
 
Add your own
alternative version
Go to top

Browser Detection using ASP.NET

, 6 May 2009
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 Capabilities_Microsoft.
	/// </summary>
	[TestFixture]
	public class Capabilities_Microsoft
	{
		Ocean.Web.HttpCapabilities.Settings Browser;
		Ocean.Web.HttpCapabilities.Result R;
		public Capabilities_Microsoft()
		{
			Browser = new Ocean.Web.HttpCapabilities.Settings(Ocean.Web.HttpCapabilities.EmbededFile.BrowserCap);
		}
		[Test]
		public void Test_CLR_1_0()
		{
			#region 1.0.2914
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0; .NET CLR 1.0.2914)");
			Assert.AreEqual("1.0.2914",R["clrVersion"], "Browser clrVersion Compare");
			
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0; DigExt; .NET CLR 1.0.2914)");
			Assert.AreEqual("1.0.2914",R["clrVersion"], "Browser clrVersion Compare");
			
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.2914)");
			Assert.AreEqual("1.0.2914",R["clrVersion"], "Browser clrVersion Compare");
			
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; {CSC}; .NET CLR 1.0.2914)");
			Assert.AreEqual("1.0.2914",R["clrVersion"], "Browser clrVersion Compare");
			
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Hotbar 3.0; .NET CLR 1.0.2914)");
			Assert.AreEqual("1.0.2914",R["clrVersion"], "Browser clrVersion Compare");
			
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.2914)");
			Assert.AreEqual("1.0.2914",R["clrVersion"], "Browser clrVersion Compare");
			#endregion
			#region 1.0.3705
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.0.2914)");
			Assert.AreEqual("1.0.3705",R["clrVersion"], "Browser clrVersion Compare");
			#endregion
			#region Contains Multple Versions (Test Most Recent Version)
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.2914; .NET CLR 1.1.4322)");
			Assert.AreEqual("1.1.4322",R["clrVersion"], "Browser clrVersion Compare");
			
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322; .NET CLR 1.0.2914)");
			Assert.AreEqual("1.1.4322",R["clrVersion"], "Browser clrVersion Compare");
			#endregion
		}
		[Test]
		public void Test_CLR_1_1()
		{
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 5.01; Windows 98; .NET CLR 1.1.4322)");
			Assert.AreEqual("1.1.4322",R["clrVersion"], "Browser clrVersion Compare");

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0; .NET CLR 1.0.3705; .NET CLR 1.1.4322)");
			Assert.AreEqual("1.1.4322",R["clrVersion"], "Browser clrVersion Compare");
						
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; .NET CLR 1.0.2914)");
			Assert.AreEqual("1.1.4322",R["clrVersion"], "Browser clrVersion Compare");
		}
		[Test]
		public void Test_CLR_1_2()
		{
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322; .NET CLR 1.2.30703)");
			Assert.AreEqual("1.2.30703",R["clrVersion"], "Browser clrVersion Compare");

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; .NET CLR 1.2.30703)");
			Assert.AreEqual("1.2.30703",R["clrVersion"], "Browser clrVersion Compare");

			//-------------------------------------------------------------------
			//1.2.x86dbg did not come in becuase it contains Leters. Current
			//code only imports Numberics
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; .NET CLR 1.2.x86dbg; .NET CLR 1.2.x86chk; .NET CLR 1.2.x86ret; .NET CLR 1.2.30509)");
			Assert.AreEqual("1.2.30509",R["clrVersion"], "Browser clrVersion Compare");

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.2.x86chk; .NET CLR 1.1.4322)");
			Assert.AreEqual("1.1.4322",R["clrVersion"], "Browser clrVersion Compare");

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; MyIE2; .NET CLR 1.1.4322; .NET CLR 1.2.30703)");
			Assert.AreEqual("1.2.30703",R["clrVersion"], "Browser clrVersion Compare");

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; .NET CLR 1.2.30703)");
			Assert.AreEqual("1.2.30703",R["clrVersion"], "Browser clrVersion Compare");

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.1.4322; .NET CLR 1.2.30703)");
			Assert.AreEqual("1.2.30703",R["clrVersion"], "Browser clrVersion Compare"); 
		}

		[Test]
		public void Test_CLR_2_0()
		{
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; AOL 9.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.40607)");
			Assert.AreEqual("2.0.40607",R["clrVersion"], "Browser clrVersion Compare");

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; AOL 9.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.40426)");
			Assert.AreEqual("2.0.40426",R["clrVersion"], "Browser clrVersion Compare");
			
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322; .NET CLR 1.0.3705; .NET CLR 2.0.40607)");
			Assert.AreEqual("2.0.40607",R["clrVersion"], "Browser clrVersion Compare");
			
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322; .NET CLR 2.0.40607)");
			Assert.AreEqual("2.0.40607",R["clrVersion"], "Browser clrVersion Compare");
			
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322; .NET CLR 2.0.40607; .NET CLR 1.0.3705)");
			Assert.AreEqual("2.0.40607",R["clrVersion"], "Browser clrVersion Compare");
			
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 2.0.40607)");
			Assert.AreEqual("2.0.40607",R["clrVersion"], "Browser clrVersion Compare");
						
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; .NET CLR 2.0.31113)");
			Assert.AreEqual("2.0.31113",R["clrVersion"], "Browser clrVersion Compare");

						
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; AOL 9.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.40426)");
			Assert.AreEqual("2.0.40426",R["clrVersion"], "Browser clrVersion Compare");

									
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; .NET CLR 2.0.31113)");
			Assert.AreEqual("2.0.31113",R["clrVersion"], "Browser clrVersion Compare");

									
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; FunWebProducts-MyWay; .NET CLR 1.1.4322; .NET CLR 2.0.40426; .NET CLR 2.0.40607)");
			Assert.AreEqual("2.0.40426",R["clrVersion"], "Browser clrVersion Compare");

									
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; .NET CLR 2.0.41115)");
			Assert.AreEqual("2.0.41115",R["clrVersion"], "Browser clrVersion Compare");

									
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; FunWebProducts-MyWay; .NET CLR 2.0.40607; .NET CLR 1.1.4322; MSIECrawler)");
			Assert.AreEqual("2.0.40607",R["clrVersion"], "Browser clrVersion Compare");
									
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.1.4322; .NET CLR 2.0.31113)");
			Assert.AreEqual("2.0.31113",R["clrVersion"], "Browser clrVersion Compare");						

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.1.4322; .NET CLR 2.0.41013)");
			Assert.AreEqual("2.0.41013",R["clrVersion"], "Browser clrVersion Compare");
		}
		[Test]
		public void Test_IE_3X()
		{
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/2.0 (compatible; MSIE 3.01; AK; Windows 95)");                  
			Assert.AreEqual("IE",R.Browser, "Browser Name Compare");     
			Assert.AreEqual("3.01",R.Version, "Browser Version Compare");   

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/2.0 (compatible; MSIE 3.01; Windows 95)");  
			Assert.AreEqual("IE",R.Browser, "Browser Name Compare");     
			Assert.AreEqual("3.01",R.Version, "Browser Version Compare");   

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/2.0 (compatible; MSIE 3.02; Update a; AK; Windows 95)");        
			Assert.AreEqual("IE",R.Browser, "Browser Name Compare");     
			Assert.AreEqual("3.02",R.Version, "Browser Version Compare");   

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/2.0 (compatible; MSIE 3.02; Update a; Windows 95)");            
			Assert.AreEqual("IE",R.Browser, "Browser Name Compare");     
			Assert.AreEqual("3.02",R.Version, "Browser Version Compare");   

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/2.0 (compatible; MSIE 3.02; Windows 3.1)"); 
			Assert.AreEqual("IE",R.Browser, "Browser Name Compare");     
			Assert.AreEqual("3.02",R.Version, "Browser Version Compare");   

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/2.0 (compatible; MSIE 3.02; Windows 95)");  
			Assert.AreEqual("IE",R.Browser, "Browser Name Compare");     
			Assert.AreEqual("3.02",R.Version, "Browser Version Compare");

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/3.0 (compatible; MSIE 3.0; Win95)");        
			Assert.AreEqual("IE",R.Browser, "Browser Name Compare");     
			Assert.AreEqual("3.0",R.Version, "Browser Version Compare");    

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/3.0 (compatible; MSIE 3.01; Mac_PowerPC)"); 
			Assert.AreEqual("IE",R.Browser, "Browser Name Compare");     
			Assert.AreEqual("3.01",R.Version, "Browser Version Compare");   
		}
		[Test]
		public void Test_IE_4X()
		{
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 4.0; Windows 95)");   
			Assert.AreEqual("IE",R.Browser, "Browser Name Compare");     
			Assert.AreEqual("4.0",R.Version, "Browser Version Compare");    

			//-------------------------------------------------------------------
			//this one still works but I know it is forged
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 4.0; Windows NT; ....../1.0 )");          
			Assert.AreEqual("IE",R.Browser, "Browser Name Compare");     
			Assert.AreEqual("4.0",R.Version, "Browser Version Compare");    
			
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 4.01; AOL 4.0; Mac_PPC)");                
			Assert.AreEqual("IE",R.Browser, "Browser Name Compare");     
			Assert.AreEqual("4.01",R.Version, "Browser Version Compare");   

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 4.01; AOL 4.0; Windows 95)");             
			Assert.AreEqual("IE",R.Browser, "Browser Name Compare");     
			Assert.AreEqual("4.01",R.Version, "Browser Version Compare");
			
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 4.01; AOL 4.0; Windows 98)");             
			Assert.AreEqual("IE",R.Browser, "Browser Name Compare");     
			Assert.AreEqual("4.01",R.Version, "Browser Version Compare");   
			
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 4.01; AOL 5.0; Mac_PPC)");                
			Assert.AreEqual("IE",R.Browser, "Browser Name Compare");     
			Assert.AreEqual("4.01",R.Version, "Browser Version Compare");   
			
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 4.01; AOL 7.0; Windows 98)");             
			Assert.AreEqual("IE",R.Browser, "Browser Name Compare");     
			Assert.AreEqual("4.01",R.Version, "Browser Version Compare");   
			
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 4.01; CS 2000; Windows 98)");             
			Assert.AreEqual("IE",R.Browser, "Browser Name Compare");     
			Assert.AreEqual("4.01",R.Version, "Browser Version Compare");   
		}

		[Test]
		public void Test_IE_5X()
		{
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 5.5; Windows 98; MSIECrawler)");          
			Assert.AreEqual("IE",R.Browser, "Browser Name Compare");     
			Assert.AreEqual("5.5",R.Version, "Browser Version Compare");    		   
			Assert.AreEqual(true,R.IsBot, "Browser Bot Compare");
			
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0(compatible; MSIE 5.0; Windows 98; DigExt)");                
			Assert.AreEqual("IE",R.Browser, "Browser Name Compare");     
			Assert.AreEqual("5.0",R.Version, "Browser Version Compare");    

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0(compatible; MSIE 5.5; Windows 98)");    
			Assert.AreEqual("IE",R.Browser, "Browser Name Compare");     
			Assert.AreEqual("5.5",R.Version, "Browser Version Compare");    

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 5.0; AOL 4.0; Windows 95; DigExt)");      
			Assert.AreEqual("IE",R.Browser, "Browser Name Compare");     
			Assert.AreEqual("5.0",R.Version, "Browser Version Compare");    

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 5.0; AOL 4.0; Windows 98; DigExt)");      
			Assert.AreEqual("IE",R.Browser, "Browser Name Compare");     
			Assert.AreEqual("5.0",R.Version, "Browser Version Compare");    
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 5.0; Windows 95)::ELNSB50::00004110032002580314018f000000000502000800000000");        
			Assert.AreEqual("IE",R.Browser, "Browser Name Compare");     
			Assert.AreEqual("5.0",R.Version, "Browser Version Compare");
			
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 5.0b1; Mac_PowerPC)");
			Assert.AreEqual("IE",R.Browser, "Browser Name Compare");     
			Assert.AreEqual("5.0b1",R.Version, "Browser Version Compare");  

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 5.12; AOL 5.1; Mac_PowerPC)");            
			Assert.AreEqual("IE",R.Browser, "Browser Name Compare");     
			Assert.AreEqual("5.12",R.Version, "Browser Version Compare");   

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 5.5; Windows 98; Win 9x 4.90; UOP IE501)");                
			Assert.AreEqual("IE",R.Browser, "Browser Name Compare");     
			Assert.AreEqual("5.5",R.Version, "Browser Version Compare");    
		}
		[Test]
		public void Test_IE_6X()
		{
			Ocean.Web.HttpCapabilities.Result R;

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; WOW64; SV1; .NET CLR 1.1.4322)");
			Assert.AreEqual("IE",R.Browser, "Browser Name Compare");
			Assert.AreEqual("6.0",R.Version, "Browser Version Compare");		
			Assert.AreEqual("true",R["win64"], "Browser win64 Compare"); 
			Assert.AreEqual("",R["ChipSet"], "Browser ChipSet Compare");
			Assert.AreEqual("1.1.4322",R["clrVersion"], "Browser clrVersion Compare");

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; WOW64; SV1)");
			Assert.AreEqual("IE",R.Browser, "Browser Name Compare");
			Assert.AreEqual("6.0",R.Version, "Browser Version Compare");
			Assert.AreEqual("true",R["win64"], "Browser win64 Compare"); 
			Assert.AreEqual("",R["ChipSet"], "Browser ChipSet Compare");


			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; Win64; x64; SV1)");
			Assert.AreEqual("IE",R.Browser, "Browser Name Compare");
			Assert.AreEqual("6.0",R.Version, "Browser Version Compare");
			Assert.AreEqual("true",R["win64"], "Browser win64 Compare"); 
			Assert.AreEqual("AMD or compatible",R["ChipSet"], "Browser ChipSet Compare");

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------			
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; Win64; IA64; SV1)");
			Assert.AreEqual("IE",R.Browser, "Browser Name Compare");
			Assert.AreEqual("6.0",R.Version, "Browser Version Compare");
			Assert.AreEqual("true",R["win64"], "Browser win64 Compare"); 
			Assert.AreEqual("Intel 64",R["ChipSet"], "Browser ChipSet Compare");


			//-------------------------------------------------------------------
			//This is a very unique useragent that made me laugh, which I coded special
			//-------------------------------------------------------------------
			R = Browser.Process("BeerFinder/4.0 (compatible; SNIKT 6.0; Wolverine 5.1) [http://www.wolverineandkitty.com/beer/]");
			Assert.AreEqual("IE",R.Browser, "Browser Name Compare");
			Assert.AreEqual("6.0",R.Version, "Browser Version Compare");
			
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------			
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; AOL 4.0; Windows 98)");              
			Assert.AreEqual("IE",R.Browser, "Browser Name Compare");     
			Assert.AreEqual("6.0",R.Version, "Browser Version Compare");    

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------			
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; AOL 4.0; Windows 98; Compaq)");      
			Assert.AreEqual("IE",R.Browser, "Browser Name Compare");     
			Assert.AreEqual("6.0",R.Version, "Browser Version Compare");
 
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------			
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; AOL 5.0; Windows 98)");              
			Assert.AreEqual("IE",R.Browser, "Browser Name Compare");     
			Assert.AreEqual("6.0",R.Version, "Browser Version Compare");    
			
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; AOL 5.0; Windows 98; H010818)");     
			Assert.AreEqual("IE",R.Browser, "Browser Name Compare");     
			Assert.AreEqual("6.0",R.Version, "Browser Version Compare");    

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------			
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; AOL 6.0; Windows 98)");              
			Assert.AreEqual("IE",R.Browser, "Browser Name Compare");     
			Assert.AreEqual("6.0",R.Version, "Browser Version Compare");    
			
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------			
			R = Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; AOL 6.0; Windows 98; {60265C40-F022-11D7-A8DF-0040057B9677})");                  
			Assert.AreEqual("IE",R.Browser, "Browser Name Compare");     
			Assert.AreEqual("6.0",R.Version, "Browser Version Compare");
		}

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

			//Mozilla/4.0 WebTV/2.6 Rogers/2.0 (compatible; MSIE 4.0)
			//Mozilla/4.0 WebTV/2.8 (compatible; MSIE 4.0)
			//Mozilla/4.0 WebTV/2.8.1 (compatible; MSIE 4.0)
			//Mozilla/4.0 WebTV/2.8.2 (compatible; MSIE 4.0)

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/3.0 WebTV/1.2 (compatible; MSIE 2.0)");     
			Assert.AreEqual("WebTV",R.Browser, "Browser Name Compare");     
			Assert.AreEqual("1.2",R.Version, "Browser Version Compare");    
			Assert.AreEqual("WebTV",R.Platform, "Browser Platform Compare");  
			Assert.AreEqual("Microsoft WebTV",R.OS, "Browser OS Compare");         

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 WebTV/2.6 (compatible; MSIE 4.0)");     
			Assert.AreEqual("WebTV",R.Browser, "Browser Name Compare");     
			Assert.AreEqual("2.6",R.Version, "Browser Version Compare");    
			Assert.AreEqual("WebTV",R.Platform, "Browser Platform Compare");  
			Assert.AreEqual("Microsoft WebTV",R.OS, "Browser OS Compare");         
			
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Mozilla/4.0 WebTV/2.8.2 (compatible; MSIE 4.0)");     
			Assert.AreEqual("WebTV",R.Browser, "Browser Name Compare");     
			Assert.AreEqual("2.8",R.Version, "Browser Version Compare");    
			Assert.AreEqual("WebTV",R.Platform, "Browser Platform Compare");  
			Assert.AreEqual("Microsoft WebTV",R.OS, "Browser OS Compare");         
		}
		[Test]
		public void Test_MSMediaPlayer()
		{
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R = Browser.Process("Windows-Media-Player/10.00.00.3473");     
			Assert.AreEqual("Microsoft Media Player",R.Browser, "Browser Name Compare");     
			Assert.AreEqual("10.00.00.3473",R.Version, "Browser Version Compare");    		 
			Assert.AreEqual("Microsoft Windows",R.OS, "Browser OS Compare");         
			
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------						
			R = Browser.Process("Windows-Media-Player/9.00.00.3250");     
			Assert.AreEqual("Microsoft Media Player",R.Browser, "Browser Name Compare");     
			Assert.AreEqual("9.00.00.3250",R.Version, "Browser Version Compare");    
			Assert.AreEqual("Microsoft Windows",R.OS, "Browser OS Compare");         
			
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------			
			R = Browser.Process("Windows-Media-Player/7.00.00.1440");     
			Assert.AreEqual("Microsoft Media Player",R.Browser, "Browser Name Compare");     
			Assert.AreEqual("7.00.00.1440",R.Version, "Browser Version Compare");    
			Assert.AreEqual("Unknown",R.Platform, "Browser Platform Compare");  
			Assert.AreEqual("Microsoft Windows",R.OS, "Browser OS Compare");         
			
			/*
			Windows-Media-Player/10.00.00.3473
			Windows-Media-Player/10.00.00.3646
			Windows-Media-Player/7.00.00.1440
			Windows-Media-Player/7.00.00.1442
			Windows-Media-Player/7.00.00.1954
			Windows-Media-Player/7.00.00.1956
			Windows-Media-Player/7.00.00.1958
			Windows-Media-Player/7.01.00.3055
			Windows-Media-Player/7.10.00.3056
			Windows-Media-Player/7.10.00.3059
			Windows-Media-Player/7.10.00.3068
			Windows-Media-Player/7.10.00.3075
			Windows-Media-Player/8.00.00.4477
			Windows-Media-Player/8.00.00.4482
			Windows-Media-Player/8.00.00.4487
			Windows-Media-Player/8.00.00.4491
			Windows-Media-Player/8.00.00.4492
			Windows-Media-Player/9.00.00.2799
			Windows-Media-Player/9.00.00.2800
			Windows-Media-Player/9.00.00.2926
			Windows-Media-Player/9.00.00.2980
			Windows-Media-Player/9.00.00.2991
			Windows-Media-Player/9.00.00.3003
			Windows-Media-Player/9.00.00.3005
			Windows-Media-Player/9.00.00.3008
			Windows-Media-Player/9.00.00.3014
			Windows-Media-Player/9.00.00.3075
			Windows-Media-Player/9.00.00.3093
			Windows-Media-Player/9.00.00.3128
			Windows-Media-Player/9.00.00.3250
			*/
		}
	}
}

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.
Follow on   Twitter   Google+   LinkedIn

| Advertise | Privacy | Mobile
Web04 | 2.8.140922.1 | Last Updated 6 May 2009
Article Copyright 2004 by Chris Maunder
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid