Share via


Browser Property

Returns the type of browser. The default value is Unknown.

public string Browser {
   get
}

Inheritance

The Browser property is inherited from the System.Web.HttpBrowserCapabilities class.

Example values include: Pocket IE, Microsoft Explorer, Nokia, Phone.com, Ericsson, and i-mode.

Example

The following example demonstrates how to use the Browser property to display a warning message to the user.

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

   Dim currentCapabilities As MobileCapabilities =  CType(Request.Browser,MobileCapabilities)
   If currentCapabilities.Browser <> "IE" Then
      Label1.Text = "Best viewed with Internet Explorer"
   End If
End Sub

[C#]
public void Page_Load(Object sender, EventArgs e)
{
   MobileCapabilities currentCapabilities
      = (MobileCapabilities)Request.Browser;
   if (currentCapabilities.Browser !="IE")
   {
      lblNotice.Text = "Best viewed with Internet Explorer";
   }
}

See Also

MobileCapabilities Class