Determining what capabilities ASP.NET is using to render pages

When you make a request to an ASP.NET based site, the browser's capabilities are determined by the <browserCaps> section in the 1.x Framework and the .browser files in the 2.0 framework.  Knowing which capabilites that ASP.NET is using to render the page can be especially important in mobile applications. 

You can use the following page to return all the MobileCapabilities for the device by browsing the page:


@ Page language="c#" AutoEventWireup="true" Inherits="System.Web.UI.MobileControls.MobilePage" %><%@ Import namespace="System.Web.Mobile" %><%@ Import namespace="System.Reflection" %><script runat="server">     protected void Page_Load(Object sender, EventArgs e) { MobileCapabilities capabilities = (MobileCapabilities)Request.Browser;          Type t = typeof(MobileCapabilities);          PropertyInfo[] propertyInfos = t.GetProperties();          foreach(PropertyInfo pi in propertyInfos) { System.Web.UI.MobileControls.Label lbl = new  System.Web.UI.MobileControls.Label(); lbl.Text = pi.Name + " = " + capabilities[pi.Name]; Form1.Controls.Add(lbl); } }</script><mobile:Form id=Form1 runat="server"></mobile:Form>

The MobileCapabilities are determined by the UserAgent string that ASP.NET receives.  You can log the UserAgent string in the IIS logs or you can use a tool like Fiddler or Web Development Helper in IE to get this information.  Once you have the UserAgent string, you can use Fiddler to pass the same UserAgent string while browsing in IE.  This will give you a larger viewing area for looking at hte list of MobileCapabilities.