How to get information about the current browser

This code shows you how ASP.NET simplifies information about the current browser into class properites. There are others but these are the most useful.

<%@ Page Language="c#" %>
<script runat="server">

   public void Page_Load(Object sender, EventArgs e) {
     HttpBrowserCapabilities bc = Request.Browser;
     Response.Write("Name = " + bc.Browser + "<br>");
     Response.Write("Version = " + bc.Version + "<br>");
     Response.Write("Platform = " + bc.Platform + "<br>");
     Response.Write("Is Crawler = " + bc.Crawler + "<br>");
     Response.Write("Is AOL = " + bc.AOL + "<br>");


You might also like...


Edward Tanguay Edward Tanguay updates his personal web site weekly with code, links, quotes and thoughts on web development. Sign up for the free newsletter.


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Memory is like an orgasm. It's a lot better if you don't have to fake it.” - Seymour Cray