Click here to Skip to main content
13,000,324 members (57,954 online)
Click here to Skip to main content
Articles » Web Development » ASP.NET » General » Downloads


186 bookmarked
Posted 1 Jun 2004

Browser Detection using ASP.NET

, 6 May 2009
Using and updating your machine.config file to better detect browser type in ASP.NET
Hello everyone.

I guess if you�re reading this you have downloaded my HttpCapabilities C# code. I designed this code to be able to read and process Microsoft Browsercap config, and allow me to debug and test my changes. I have made a lot of changes mostly to make it work for how I am using it currently. I am currently using this as part of a larger program to process Useragent info from log files and identify the browser and search engines that visit my website. This can be used from an asp webpage I just have not tested it in that area.  I wanted to release this project so others might be able to use it to help improve there site and testing of there browsercap changes. If you have questions you can email me at and put "HttpCapabilities" as part of the subject line so it gets filtered to the correct directory. I have only tested this project with 1.1, it should work in 1.0. 

The zip file which this readme was in can also be found at

Currently Mono fails some of the nunit tests. I will submit the bugs to mono dev team, and hopefully be able to fix the bugs in the regular expressions. (Mono windows version 1.7.0)

The file CodeProject.xml is free to the public and has no license limitations placed on it. I dowloaded it from, and have made a number of edits adding new browsers and making sure the browsercap information can identify most of the browsers activily used in the market.

Added a command line tool that reads in Useragents from the stdin and outputs the browser details to stdout in xml format. There is a command line bat file Sample.bat showing the basics how to use the command line tool. I do not know of any tools that will use this command line program, it is ment as an example on what can be done with my HttpCapabilities Libary.

The batch file has two lines in it. These two lines types the UserAgent.txt to the standard out which is piped into the standard HttpCapabilities command line utility, which then outputs its results and is saved in "SampleOutput.xml" which on the next line is run.
type UserAgents.txt | Ocean.Cmd.HttpCapabilities.exe CodeProject.xml >SampleOutput.xml

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.


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


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...

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