Sniffing Browser Details ...

This quick article provides different ways in which can identify the web browser and thus offer a rich experience for the end user by customizing the website/application, leveraging the potential of the same.


It has been indeed a long story of browser wars and browser compatibility and Webmasters have always been constantly having their fingers crossed to keep their websites/web applications as compatible as far as possible amongst the major browsers. With the advent of ASP.NET, making the web pages compatible with at least the major browsers has been made a bit easier and a pleasant thing to work with.

Server-Centric Model

With all validator controls and other major parts of a webpage are now made as Server Controls, the Web Server now takes the responsibility of rendering the pages that is optimal to the client browser. While Validator controls deliver rich client side validations for an up level browser like MSIE 5.5 or higher, with older browsers, the page automatically posts back to the Server but of course, Server Side Processing Scripts are deferred from executing till the Page.IsValid is true. This greatly eliminates the need of redundant client side validation for each browser.

Rejuvenating the page content

However, with high traffic portal applications, the Webmaster might be concerned with delivering the best browsing experience and a page that best renders on each type of browsers, rather than depending upon the automatic down leveling strategy adopted by ASP.NET with its Server-Centric trick. ASP.NET Comes to our rescue in detecting the browser and its abilities with is Request.Browser property

Browser Detection Strategies

  • Request.Browser depends on System.Web.HttpBrowserCapabilities class and this property exposes a host of information regarding the browser/user agent that is visiting our page. Included typically are whether the browser supports the latest W3C DOM and whether it is a simple web browser and a Crawler that is crawling the webpage.

    The code below shows a brief browser detection using Request.Browser:


I hope the above article would be greatly useful to developers involved in delivering ASP.NET Web Portal applications and to webmasters in making their web portals/applications best render with different types of web browsers, making the best use of the support that ASP.NET offers towards browser compatibility.


No responses found. Be the first to comment...

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: