Configure .NET 2.0 for BlackBerry Browser support

by BlackBerry Development Advisor ‎02-17-2010 09:04 AM - edited ‎09-20-2010 05:17 PM (4,578 Views)

 


Summary

This article applies to the following:

  • BlackBerry® Device Simulator 4.1.0 for the BlackBerry® 8700 Series
  • BlackBerry® Browser
  • Microsoft® .NET Framework 2.0
  • Microsoft .NET adaptive control architecture

 


Details

By default, the Microsoft .NET 2.0 adaptive control architecture includes support for mobile browsers (Microsoft .NET 1.1 does not). However, the Microsoft .Net 2.0 default control behaviors, when used with the BlackBerry Browser, support HTML only, and do not support JavaScript®, ECMAScript, or cascading style sheets (CSS).

To configure support for the BlackBerry Browser on Microsoft .NET 2.0, complete the following tasks:

Task 1 - Configure the BlackBerry Browser settings

To configure the default support settings for the BlackBerry Browser, complete the following:

  1. On the BlackBerry Device Simulator, open the BlackBerry Browser.
  2. Click the trackwheel, and select Options.
  3. Select Browser Configuration. (A sample of the Browser Configuration window is shown below.)
  4. Make sure that the settings Support Javascript, Support HTML Tables, and Support Style Sheets are turned on. Optionally, you can also turn on the settings Use Foreground and Background Colors, and Background Colors.
  5. Save these changes
    DB-00593.jpg

Task 2 - Create a BlackBerry.browser configuration file

In Microsoft .NET 2.0, browser support is managed from within the application or by the defaults that are installed with the framework.

Here is a sample BlackBerry.browser configuration file that will support the feature set created in Task

  1. Create a file called BlackBerry.browser.
  2. Copy the following text into the file:

    <browsers>

    <browser id="BlackBerry" parentID="Default">
    <identification>
    <userAgent match="BlackBerry(?'model'\d+)/(?'version'((?'major'\d+).(?'minor'\d+).(?'other'\d+)))" />
    </identification>

    <capabilities>
    <capability name="browser" value="BlackBerry" />
    <capability name="isMobileDevice" value="true" />
    <capability name="javascript" value="true" />
    <capability name="ecmascriptversion" value="1.3" />
    <capability name="version" value="${version}" />
    <capability name="majorVersion" value="${major}" />
    <capability name="minorVersion" value="${minor}" />
    <capability name="supportsCss" value="true" />
    <capability name="frames" value="false" />
    <capability name="cookies" value="true" />
    </capabilities>
    </browser>

    </browsers>

     

     

  3. Save the file in the Browsers directory (e.g. C:\\WINDOWS\Microsoft.NET\Framework\V2.0.50727\CONFIG\Browsers)

Task 3 - Register the new browser configurations with Microsoft ASP.NET

To use the Microsoft .NET 2.0 adaptive control architecture with the BlackBerry Browser, the new browser configuration must be registered.

To perform the registration, use the command line tool aspnet_regbrowsers.exe. This tool will create an assembly based on the information in the *.browser files and will install the assembly into the global assembly cache. Additional information on this tool can be found at the Microsoft Developer Network web site.

From a command prompt, enter the path to aspnet_regbrowsers.exe and use the -i switch to register the browser configurations. For example, C:\\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regbrowsers.exe -i

You should now be able to use Microsoft .NET 2.0 adaptive control architecture with the BlackBerry Browser.

From Microsoft Visual Studio®, choose New/Web Site and select ASP.NET Web Site as your template. Use the existing Microsoft .NET 2.0 controls to manage your web application.