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

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.CodeProject
{
	/// <summary>
	/// Summary description for Capabilities_Opera.
	/// </summary>
	[TestFixture]
	public class Capabilities_Opera
	{
		Ocean.Web.HttpCapabilities.Settings Browser;
		Ocean.Web.HttpCapabilities.Result R;
		public Capabilities_Opera()
		{
			Browser = new Ocean.Web.HttpCapabilities.Settings(Ocean.Web.HttpCapabilities.EmbededFile.CodeProject);
		}
		[Test]
		public void Test_Opera3()
		{
			R =Browser.Process("Mozilla/4.0 (Windows 98;US) Opera 3.61  [en]");     
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("3.61",R.Version, "Browser Version Compare");   
			Assert.AreEqual("Win9X",R.Platform, "Browser Platform Compare");
			Assert.AreEqual("System.Web.UI.Html32TextWriter",R["tagwriter"],"tagwriter");
		}
		[Test]
		public void Test_Opera4()
		{
			R =Browser.Process("Mozilla/4.01 (compatible; MSIE 5.0; Windows 98) Opera 4.01  [en]");     
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("4.01",R.Version, "Browser Version Compare");   
			Assert.AreEqual("Win9X",R.Platform, "Browser Platform Compare");
			Assert.AreEqual("System.Web.UI.Html32TextWriter",R["tagwriter"],"tagwriter");
		}
		[Test]
		public void Test_Opera5()
		{
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/4.0 (compatible; MSIE 5.0; Linux) Opera 5.0  [en]");            
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("5.0",R.Version, "Browser Version Compare");    
			Assert.AreEqual("Unknown",R.Platform, "Browser Platform Compare"); 
			Assert.AreEqual("System.Web.UI.Html32TextWriter",R["tagwriter"],"tagwriter");

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/4.0 (compatible; MSIE 5.0; Linux 2.4.18 i686) Opera 5.0  [en]");
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("5.0",R.Version, "Browser Version Compare");    
			Assert.AreEqual("Intel",R.Platform, "Browser Platform Compare");
			Assert.AreEqual("System.Web.UI.Html32TextWriter",R["tagwriter"],"tagwriter");

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/4.0 (compatible; MSIE 5.0; Mac_PowerPC) Opera 5.0  [en]");      
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("5.0",R.Version, "Browser Version Compare");    
			Assert.AreEqual("MacPPC",R.Platform, "Browser Platform Compare"); 
			Assert.AreEqual("System.Web.UI.Html32TextWriter",R["tagwriter"],"tagwriter");

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/4.0 (compatible; MSIE 5.0; Windows 2000) Opera 5.11  [en]");    
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("5.11",R.Version, "Browser Version Compare");   
			Assert.AreEqual("WinNT",R.Platform, "Browser Platform Compare");  
			Assert.AreEqual("System.Web.UI.Html32TextWriter",R["tagwriter"],"tagwriter");
			 
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/4.0 (compatible; MSIE 5.0; Windows 2000) Opera 5.12  [en]");    
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("5.12",R.Version, "Browser Version Compare");   
			Assert.AreEqual("WinNT",R.Platform, "Browser Platform Compare"); 
			Assert.AreEqual("System.Web.UI.Html32TextWriter",R["tagwriter"],"tagwriter");

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/4.0 (compatible; MSIE 5.0; Windows 98) Opera 5.02  [de]");      
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("5.02",R.Version, "Browser Version Compare");   
			Assert.AreEqual("Win9X",R.Platform, "Browser Platform Compare");  
			Assert.AreEqual("System.Web.UI.Html32TextWriter",R["tagwriter"],"tagwriter");
			    
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/4.0 (compatible; MSIE 5.0; Windows 98) Opera 5.02  [en]");      
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("5.02",R.Version, "Browser Version Compare");   
			Assert.AreEqual("Win9X",R.Platform, "Browser Platform Compare");  
			Assert.AreEqual("System.Web.UI.Html32TextWriter",R["tagwriter"],"tagwriter");
			    
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/4.0 (compatible; MSIE 5.0; Windows 98) Opera 5.10  [en]");      
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("5.10",R.Version, "Browser Version Compare");   
			Assert.AreEqual("Win9X",R.Platform, "Browser Platform Compare");  
			Assert.AreEqual("System.Web.UI.Html32TextWriter",R["tagwriter"],"tagwriter");
			    
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/4.0 (compatible; MSIE 5.0; Windows 98) Opera 5.11  [en]");      
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("5.11",R.Version, "Browser Version Compare");   
			Assert.AreEqual("Win9X",R.Platform, "Browser Platform Compare");  
			Assert.AreEqual("System.Web.UI.Html32TextWriter",R["tagwriter"],"tagwriter");

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/4.0 (compatible; MSIE 5.0; Windows ME) Opera 5.11 [en]");       
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("5.11",R.Version, "Browser Version Compare");   
			Assert.AreEqual("Win9X",R.Platform, "Browser Platform Compare");  
			Assert.AreEqual("System.Web.UI.Html32TextWriter",R["tagwriter"],"tagwriter");
			   
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/4.0 (compatible; MSIE 5.0; Windows ME) Opera 5.12  [en]");      
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("5.12",R.Version, "Browser Version Compare");   
			Assert.AreEqual("Win9X",R.Platform, "Browser Platform Compare");  
			Assert.AreEqual("System.Web.UI.Html32TextWriter",R["tagwriter"],"tagwriter");
			   
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/4.0 (compatible; MSIE 5.0; Windows ME) Opera 5.12  [es]");      
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("5.12",R.Version, "Browser Version Compare");   
			Assert.AreEqual("Win9X",R.Platform, "Browser Platform Compare");  
			Assert.AreEqual("System.Web.UI.Html32TextWriter",R["tagwriter"],"tagwriter");

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/4.0 (compatible; MSIE 5.0; Windows NT 5.1) Opera 5.12  [en]");  
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("5.12",R.Version, "Browser Version Compare");   
			Assert.AreEqual("WinNT",R.Platform, "Browser Platform Compare");  
			Assert.AreEqual("System.Web.UI.Html32TextWriter",R["tagwriter"],"tagwriter");

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------			
			R =Browser.Process("Opera/5.12 (Windows 98; U)  [en]");                 
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("5.12",R.Version, "Browser Version Compare");   
			Assert.AreEqual("Win9X",R.Platform, "Browser Platform Compare"); 
			Assert.AreEqual("System.Web.UI.Html32TextWriter",R["tagwriter"],"tagwriter");
		}
		[Test]
		public void Test_Opera6()
		{
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/3.0 (Windows 98; U) Opera 6.05  [en]");     
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("6.05",R.Version, "Browser Version Compare");   
			Assert.AreEqual("Win9X",R.Platform, "Browser Platform Compare"); 
			Assert.AreEqual("System.Web.UI.Html32TextWriter",R["tagwriter"],"tagwriter");

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/4.0 (compatible; MSIE 5.0; Linux) Opera 6.0  [en]");            
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("6.0",R.Version, "Browser Version Compare");    
			Assert.AreEqual("Unknown",R.Platform, "Browser Platform Compare"); 
			Assert.AreEqual("System.Web.UI.Html32TextWriter",R["tagwriter"],"tagwriter");

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/4.0 (compatible; MSIE 5.0; Linux 2.4.2 i386) Opera 6.11  [en]");
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("6.11",R.Version, "Browser Version Compare");   
			Assert.AreEqual("Intel",R.Platform, "Browser Platform Compare");             
			Assert.AreEqual("System.Web.UI.Html32TextWriter",R["tagwriter"],"tagwriter");

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/4.0 (compatible; MSIE 5.0; Linux 2.4.7-10 i686) Opera 6.12  [en]");              
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("6.12",R.Version, "Browser Version Compare");   
			Assert.AreEqual("Intel",R.Platform, "Browser Platform Compare");             
			Assert.AreEqual("System.Web.UI.Html32TextWriter",R["tagwriter"],"tagwriter");

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/4.0 (compatible; MSIE 5.0; Mac_PowerPC) Opera 6.0  [en]");      
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("6.0",R.Version, "Browser Version Compare");    
			Assert.AreEqual("MacPPC",R.Platform, "Browser Platform Compare"); 
			Assert.AreEqual("System.Web.UI.Html32TextWriter",R["tagwriter"],"tagwriter");

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/4.0 (compatible; MSIE 5.0; Windows 2000) Opera 6.01  [en]");    
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("6.01",R.Version, "Browser Version Compare");   
			Assert.AreEqual("WinNT",R.Platform, "Browser Platform Compare");  
			Assert.AreEqual("System.Web.UI.Html32TextWriter",R["tagwriter"],"tagwriter");

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/4.0 (compatible; MSIE 5.0; Windows 2000) Opera 6.01 [en]");     
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("6.01",R.Version, "Browser Version Compare");   
			Assert.AreEqual("WinNT",R.Platform, "Browser Platform Compare");  
			Assert.AreEqual("System.Web.UI.Html32TextWriter",R["tagwriter"],"tagwriter");

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/4.0 (compatible; MSIE 5.0; Windows 2000) Opera 6.02  [en]");    
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("6.02",R.Version, "Browser Version Compare");   
			Assert.AreEqual("WinNT",R.Platform, "Browser Platform Compare");  
			Assert.AreEqual("System.Web.UI.Html32TextWriter",R["tagwriter"],"tagwriter");

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/4.0 (compatible; MSIE 5.0; Windows 2000) Opera 6.03  [en]");    
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("6.03",R.Version, "Browser Version Compare");   
			Assert.AreEqual("WinNT",R.Platform, "Browser Platform Compare");  
			Assert.AreEqual("System.Web.UI.Html32TextWriter",R["tagwriter"],"tagwriter");

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/4.0 (compatible; MSIE 5.0; Windows 2000) Opera 6.04  [en]");    
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("6.04",R.Version, "Browser Version Compare");   
			Assert.AreEqual("WinNT",R.Platform, "Browser Platform Compare");  
			Assert.AreEqual("System.Web.UI.Html32TextWriter",R["tagwriter"],"tagwriter");

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/4.0 (compatible; MSIE 5.0; Windows 2000) Opera 6.05  [en]");    
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("6.05",R.Version, "Browser Version Compare");   
			Assert.AreEqual("WinNT",R.Platform, "Browser Platform Compare");  
			Assert.AreEqual("System.Web.UI.Html32TextWriter",R["tagwriter"],"tagwriter");

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/4.78 (Windows 95; U) Opera 6.05  [cs]");    
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("6.05",R.Version, "Browser Version Compare");   
			Assert.AreEqual("Win9X",R.Platform, "Browser Platform Compare");  Assert.AreEqual("System.Web.UI.Html32TextWriter",R["tagwriter"],"tagwriter");

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/4.78 (Windows XP; U) Opera 6.05  [en]");    
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("6.05",R.Version, "Browser Version Compare");   
			Assert.AreEqual("WinNT",R.Platform, "Browser Platform Compare"); 
			Assert.AreEqual("System.Web.UI.Html32TextWriter",R["tagwriter"],"tagwriter");

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/5.0 (Windows 2000; U) Opera 6.05  [en]");   
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("6.05",R.Version, "Browser Version Compare");   
			Assert.AreEqual("WinNT",R.Platform, "Browser Platform Compare");  	
			Assert.AreEqual("System.Web.UI.Html32TextWriter",R["tagwriter"],"tagwriter");

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/5.0 (Windows 98; U) Opera 6.01  [en]");     
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("6.01",R.Version, "Browser Version Compare");   
			Assert.AreEqual("Win9X",R.Platform, "Browser Platform Compare");  
			Assert.AreEqual("System.Web.UI.Html32TextWriter",R["tagwriter"],"tagwriter");

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/5.0 (Windows ME; U) Opera 6.04  [ru] WebWasher 3.0");           
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("6.04",R.Version, "Browser Version Compare");   
			Assert.AreEqual("Win9X",R.Platform, "Browser Platform Compare");  
			Assert.AreEqual("System.Web.UI.Html32TextWriter",R["tagwriter"],"tagwriter");

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------			
			R =Browser.Process("Mozilla/5.0 (Windows XP; U) Opera 6.06  [fr]");     
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("6.06",R.Version, "Browser Version Compare");   
			Assert.AreEqual("WinNT",R.Platform, "Browser Platform Compare");
			Assert.AreEqual("System.Web.UI.Html32TextWriter",R["tagwriter"],"tagwriter");

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Opera/6.11 (Linux 2.4.18-19.8.0 i686; U)  [en]");   
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("6.11",R.Version, "Browser Version Compare");   
			Assert.AreEqual("Intel",R.Platform, "Browser Platform Compare");  
			Assert.AreEqual("System.Web.UI.Html32TextWriter",R["tagwriter"],"tagwriter");

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Opera/6.11 (Linux 2.4.18-19.8.0 i686; U)  [en]");   
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("6.11",R.Version, "Browser Version Compare");   
			Assert.AreEqual("Intel",R.Platform, "Browser Platform Compare");  
		}
		[Test]
		public void Test_Opera7()
		{
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/3.0 (Windows 98; U) Opera 7.21  [en]");     
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("7.21",R.Version, "Browser Version Compare");   
			Assert.AreEqual("Win9X",R.Platform, "Browser Platform Compare"); 
			Assert.AreEqual("System.Web.UI.HtmlTextWriter",R["tagwriter"],"tagwriter");

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/3.0 (Windows NT 5.1; U) Opera 7.23  [en]"); 
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("7.23",R.Version, "Browser Version Compare");   
			Assert.AreEqual("WinNT",R.Platform, "Browser Platform Compare");  
			Assert.AreEqual("System.Web.UI.HtmlTextWriter",R["tagwriter"],"tagwriter");

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------			
			R =Browser.Process("Mozilla/4.0 (compatible; MSIE 5.23; Mac_PowerPC) Opera 7.54  [en]");    
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("7.54",R.Version, "Browser Version Compare");   
			Assert.AreEqual("MacPPC",R.Platform, "Browser Platform Compare"); 
			Assert.AreEqual("System.Web.UI.HtmlTextWriter",R["tagwriter"],"tagwriter");
			           
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; Linux 2.4.21-99-athlon i686) Opera 7.11  [en]");      
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("7.11",R.Version, "Browser Version Compare");   
			Assert.AreEqual("Intel",R.Platform, "Browser Platform Compare");             
			Assert.AreEqual("System.Web.UI.HtmlTextWriter",R["tagwriter"],"tagwriter");
			
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows 2000) Opera 7.0  [en]");            
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("7.0",R.Version, "Browser Version Compare");    
			Assert.AreEqual("WinNT",R.Platform, "Browser Platform Compare");  
			Assert.AreEqual("System.Web.UI.HtmlTextWriter",R["tagwriter"],"tagwriter");
			
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows 98) Opera 7.0  [en]");              
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("7.0",R.Version, "Browser Version Compare");    
			Assert.AreEqual("Win9X",R.Platform, "Browser Platform Compare");  
			Assert.AreEqual("System.Web.UI.HtmlTextWriter",R["tagwriter"],"tagwriter");    
			
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows 98) Opera 7.01  [en]");             
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("7.01",R.Version, "Browser Version Compare");   
			Assert.AreEqual("Win9X",R.Platform, "Browser Platform Compare");  
			Assert.AreEqual("System.Web.UI.HtmlTextWriter",R["tagwriter"],"tagwriter");    
			
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows 98) Opera 7.02  [en]");             
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("7.02",R.Version, "Browser Version Compare");   
			Assert.AreEqual("Win9X",R.Platform, "Browser Platform Compare");  
			Assert.AreEqual("System.Web.UI.HtmlTextWriter",R["tagwriter"],"tagwriter");    
			
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows 98) Opera 7.02 Bork-edition  [en]");
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("7.02",R.Version, "Browser Version Compare");   
			Assert.AreEqual("Win9X",R.Platform, "Browser Platform Compare");  
			Assert.AreEqual("System.Web.UI.HtmlTextWriter",R["tagwriter"],"tagwriter");    
			
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows 98) Opera 7.03  [en]");             
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("7.03",R.Version, "Browser Version Compare");   
			Assert.AreEqual("Win9X",R.Platform, "Browser Platform Compare");  
			Assert.AreEqual("System.Web.UI.HtmlTextWriter",R["tagwriter"],"tagwriter");    
			
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows 98) Opera 7.03  [es-ES]");          
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("7.03",R.Version, "Browser Version Compare");   
			Assert.AreEqual("Win9X",R.Platform, "Browser Platform Compare");  
			Assert.AreEqual("System.Web.UI.HtmlTextWriter",R["tagwriter"],"tagwriter");    
			
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows 98) Opera 7.03  [nb]");             
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("7.03",R.Version, "Browser Version Compare");   
			Assert.AreEqual("Win9X",R.Platform, "Browser Platform Compare");  
			Assert.AreEqual("System.Web.UI.HtmlTextWriter",R["tagwriter"],"tagwriter");    
			
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows ME) Opera 7.0  [en]");              
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("7.0",R.Version, "Browser Version Compare");    
			Assert.AreEqual("Win9X",R.Platform, "Browser Platform Compare");  
			Assert.AreEqual("System.Web.UI.HtmlTextWriter",R["tagwriter"],"tagwriter");
   
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows ME) Opera 7.01  [en]");             
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("7.01",R.Version, "Browser Version Compare");   
			Assert.AreEqual("Win9X",R.Platform, "Browser Platform Compare");  
			Assert.AreEqual("System.Web.UI.HtmlTextWriter",R["tagwriter"],"tagwriter");   
			
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows ME) Opera 7.03  [de]");             
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("7.03",R.Version, "Browser Version Compare");   
			Assert.AreEqual("Win9X",R.Platform, "Browser Platform Compare");  
			Assert.AreEqual("System.Web.UI.HtmlTextWriter",R["tagwriter"],"tagwriter");   
			
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows ME) Opera 7.03  [en]");             
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("7.03",R.Version, "Browser Version Compare");   
			Assert.AreEqual("Win9X",R.Platform, "Browser Platform Compare");  
			Assert.AreEqual("System.Web.UI.HtmlTextWriter",R["tagwriter"],"tagwriter");   
			
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows ME) Opera 7.03  [es-ES]");          
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("7.03",R.Version, "Browser Version Compare");   
			Assert.AreEqual("Win9X",R.Platform, "Browser Platform Compare");  
			Assert.AreEqual("System.Web.UI.HtmlTextWriter",R["tagwriter"],"tagwriter");
   
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows NT 5.0) Opera 7.0  [en]");          
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("7.0",R.Version, "Browser Version Compare");    
			Assert.AreEqual("WinNT",R.Platform, "Browser Platform Compare");  
			Assert.AreEqual("System.Web.UI.HtmlTextWriter",R["tagwriter"],"tagwriter"); 
			
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; Windows 98) Opera 7.23  [de]");      
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("7.23",R.Version, "Browser Version Compare");   
			Assert.AreEqual("Win9X",R.Platform, "Browser Platform Compare");  
			Assert.AreEqual("System.Web.UI.HtmlTextWriter",R["tagwriter"],"tagwriter");
			
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) Opera 7.23  [es-ES]");                
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("7.23",R.Version, "Browser Version Compare");   
			Assert.AreEqual("WinNT",R.Platform, "Browser Platform Compare");  
			Assert.AreEqual("System.Web.UI.HtmlTextWriter",R["tagwriter"],"tagwriter");    

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; X11; Linux i586) Opera 7.52  [en]"); 
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("7.52",R.Version, "Browser Version Compare");   
			Assert.AreEqual("Intel",R.Platform, "Browser Platform Compare");             
			Assert.AreEqual("System.Web.UI.HtmlTextWriter",R["tagwriter"],"tagwriter");    

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; X11; Linux i686) Opera 7.23  [en]"); 
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("7.23",R.Version, "Browser Version Compare");   
			Assert.AreEqual("Intel",R.Platform, "Browser Platform Compare");             
			Assert.AreEqual("System.Web.UI.HtmlTextWriter",R["tagwriter"],"tagwriter");    

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; X11; Linux i686) Opera 7.50  [en]"); 
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("7.50",R.Version, "Browser Version Compare");   
			Assert.AreEqual("Intel",R.Platform, "Browser Platform Compare");             
			Assert.AreEqual("System.Web.UI.HtmlTextWriter",R["tagwriter"],"tagwriter");  
			Assert.AreEqual("1.5",R["ecmascriptversion"],"ecmascriptversion"); 

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; X11; Linux i686) Opera 7.54  [en]"); 
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("7.54",R.Version, "Browser Version Compare");   
			Assert.AreEqual("Intel",R.Platform, "Browser Platform Compare");             
			Assert.AreEqual("System.Web.UI.HtmlTextWriter",R["tagwriter"],"tagwriter"); 
			Assert.AreEqual("1.5",R["ecmascriptversion"],"ecmascriptversion"); 

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/4.78 (Windows NT 5.1; U) Opera 7.0  [en]"); 
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("7.0",R.Version, "Browser Version Compare");    
			Assert.AreEqual("WinNT",R.Platform, "Browser Platform Compare");  
			Assert.AreEqual("System.Web.UI.HtmlTextWriter",R["tagwriter"],"tagwriter"); 
			Assert.AreEqual("1.4",R["ecmascriptversion"],"ecmascriptversion"); 

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/4.78 (Windows NT 5.1; U) Opera 7.22  [pl]");
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("7.22",R.Version, "Browser Version Compare");   
			Assert.AreEqual("WinNT",R.Platform, "Browser Platform Compare");  
			Assert.AreEqual("System.Web.UI.HtmlTextWriter",R["tagwriter"],"tagwriter"); 
			Assert.AreEqual("1.4",R["ecmascriptversion"],"ecmascriptversion"); 

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/4.78 (Windows NT 5.1; U) Opera 7.50  [en]");
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("7.50",R.Version, "Browser Version Compare");   
			Assert.AreEqual("WinNT",R.Platform, "Browser Platform Compare"); 
			Assert.AreEqual("System.Web.UI.HtmlTextWriter",R["tagwriter"],"tagwriter"); 
			Assert.AreEqual("1.5",R["ecmascriptversion"],"ecmascriptversion"); 
		}
		[Test]
		public void Test_Opera8()
		{
			
			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; de) Opera 8.00 (www.proxomitron.de)");
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("8.00",R.Version, "Browser Version Compare");   
			Assert.AreEqual("WinNT",R.Platform, "Browser Platform Compare");
			Assert.AreEqual("System.Web.UI.HtmlTextWriter",R["tagwriter"],"tagwriter"); 
			Assert.AreEqual("1.5",R["ecmascriptversion"],"ecmascriptversion"); 

			//-------------------------------------------------------------------
			//
			//-------------------------------------------------------------------
			R =Browser.Process("Opera/8.00 (Windows NT 5.1; U; en)");               
			Assert.AreEqual("Opera",R.Browser, "Browser Name Compare");  
			Assert.AreEqual("8.00",R.Version, "Browser Version Compare");   
			Assert.AreEqual("WinNT",R.Platform, "Browser Platform Compare"); 
			Assert.AreEqual("System.Web.UI.HtmlTextWriter",R["tagwriter"],"tagwriter"); 
			Assert.AreEqual("1.5",R["ecmascriptversion"],"ecmascriptversion"); 
		}
	}
}

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
Web02 | 2.8.140814.1 | Last Updated 6 May 2009
Article Copyright 2004 by Chris Maunder
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid