HttpBrowserCapabilities

The current project I am working on involves a website that is external facing. Since I am using CSS and JavaScript in ASP.NET 2.0 older browsers may not behave as expected. Therefore, I implemented White, Black, and Gray browser lists.

Initially, I used a JavaScript Browser Sniffer Library written by Pau Garcia i Quiles, but then I became aware of the HttpBrowserCompatibilites class in .NET!

I just finished rewritting the lists using .NET’s Browser object ( located off the Request object ). If you are interested in knowing how .NET figures out all this information check out the Browser Definition File Schema. You can find all of the browser definitions on your machine at β€œ%SystemRoot%\Microsoft.NET\Framework\version\CONFIG\Browsers”. Its very interesting to look through the files and see what information .NET uses to determine your browser information.

If you enjoyed this post, please consider sharing it with others via the following Twitter or Reddit buttons. Also, feel free to checkout my egghead.io profile page for addition free and subscription lessons, collections, and courses. As always, you can reach out to me on Twitter at @elijahmanor. Thanks and have a blessed day!

Reddit