Bug in defining browser definitions in ASP.NET 2.0

In my previous post about browser sniffing for Windows XP MCE in ASP.NET 2.0 I alluded to a bug I encountered when trying to override new browser capabilities in a .browser file. As I explained in more detail there you can define new browser definitions by just adding a .browser file to the App_Browsers directory of your web application.

All browser definition inherit from the default browser definition. You can add new capabilities to it like so:

      <browser refID="Default">

            <capabilities>

                  <capability name="capability_1" value="1" />

            </capabilities>

      </browser>

But overriding its value like this:

      <browser refID="Mozilla">

            <capabilities>

                  <capability name="capability_1" value="2" />

            </capabilities>

      </browser>

or this:

      <browser id="TestBrowser" parentID="Mozilla">

          <identification>

              <userAgent match="TestBrowser" />

          </identification>

          <capabilities>

              <capability name="capability_1" value="3" />

          </capabilities>

      </browser>

fails. Leaving out the default browser bit and just overriding the value set for the Mozilla browser works. I have submitted a bug in the MSDN Feedback Center for this issue (bug ID FDBK40924) with an attached sample web application and steps to reproduce it. The User Agent Switcher extension for Mozilla Firefox comes in very handy to test this. You can use this User-Agent string to match the TestBrowser definition:

       Mozilla 4.0 (compatible; TestBrowser 1.0)

Please try to reproduce this bug on your system and vote for it in the MSDN Product Feedback Center. Otherwise it probably doesn't stand a chance of being fixed in the next service pack of the .NET Framework 2.0.

Leave a Reply

Your email address will not be published. Required fields are marked *