custom device adapter

Discussion in 'ASP .Net Mobile' started by steph, Oct 30, 2003.

  1. steph

    steph Guest

    I am unable to get my site to work with a new device
    adapter set that I have created. If you call a page on the
    site you get the error message:

    Server Error in '/' Application.
    -----------------------------------------------------------
    ---------------------

    Configuration Error
    Description: An error occurred during the processing of a
    configuration file required to service this request.
    Please review the specific error details below and modify
    your configuration file appropriately.

    Parser Error Message:
    Type 'BangoAdapters.BangoMLPageAdapter' used as
    PredicateClass not found.

    Source Error:


    Line 822: <control
    Line 823:
    name="System.Web.UI.MobileControls.Label"
    Line 824:
    adapter="System.Web.UI.MobileControls.Adapters.HtmlLabelAda
    pter" />
    Line 825: <control
    Line 826:
    name="System.Web.UI.MobileControls.LiteralText"


    Source File: c:\winnt\microsoft.net\framework\v1.1.4322
    \Config\machine.config Line: 824


    -----------------------------------------------------------
    ---------------------
    Version Information: Microsoft .NET Framework
    Version:1.1.4322.573; ASP.NET Version:1.1.4322.573




    I created the new device adapter set based upon the
    existing wml one. The code for this is in the
    machine.config:

    .. all the other existing device
    adapters ...

    <device
    name="BangoMLDeviceAdapters"
    inheritsFrom="WmlDeviceAdapters"

    predicateClass="BangoAdapters.BangoMLPageAdapter"
    predicateMethod="DeviceQualifies"

    pageAdapter="BangoAdapters.BangoMLPageAdapter">
    </device>

    </mobileControls>



    Then I have created the predicate class which has just the
    predicate method, which determines whether or not this
    device adapter should be used, based on some sample code
    in an MSPress book. The only difference between this and
    the sample code in the book is I had to put 'new' at the
    start of the DeviceQualifies property else it would not
    build as it said "The keyword new is required
    on 'BangoAdapters.BangoMLPageAdapter.DeviceQualifies
    (System.Web.HttpContext)' because it hides inherited
    member 'System.Web.UI.MobileControls.Adapters.WmlPageAdapte
    r.DeviceQualifies(System.Web.HttpContext)'". Alternatively
    I also tried calling it DeviceQualifies2 and changed the
    predicateMethod in the code above to this method too, but
    that didn't work either:


    using System;
    using System.Web;
    using System.Web.Mobile;
    using System.Web.UI.MobileControls.Adapters;


    namespace BangoAdapters
    {
    public class BangoMLPageAdapter : WmlPageAdapter
    {
    new public static bool DeviceQualifies
    (HttpContext context)
    {
    MobileCapabilities capabilities =
    ((MobileCapabilities)context.Request.Browser);
    bool qualifies =
    capabilities.Browser == "Test Browser";
    return qualifies;
    }
    }
    }



    This should just inherit from the WmlPageAdapter and
    because at the moment I haven't over-ridden any of the
    properties or methods produce exactly the same output as
    the WmlPageAdapter.


    The error message seems to be saying it can't find the
    predicate class. The suggestion in the book seems to be
    that if the assembly containing the predicate class is
    referenced in the project then all should be well. However
    this seems not to be the case. I'm sure that the assembly
    is valid since the intellisense and the drill down in
    Visual Studio can both correctly see the class in the
    assembly so I'm guessing that the machine.config does not
    know about the assembly for some reason.

    I tried adding an assembly tag in the machine.config
    specifying the name and version of the assembly as follows
    but this did not seem to cure the problem. Then I tried
    adding the assembly to the Global Assembly Cache to see if
    that allowed machine.config to find it but that did not
    seem to make any difference either.

    <assemblies>
    <add
    assembly="BangoAdapters,Version=1.0.1396.34694,Culture=neut
    ral,PublicKeyToken=efd73c7058cf2996" />
    </assemblies>

    Can anyone see what the problem is here?
    steph, Oct 30, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. nishadixit
    Replies:
    5
    Views:
    1,252
    Joe Discar
    Jun 1, 2005
  2. Replies:
    1
    Views:
    426
    santosh
    Nov 27, 2006
  3. Joaquim Raurell Martí

    MMIT in VS 2003, and create a new device set adapter

    Joaquim Raurell Martí, Jul 21, 2003, in forum: ASP .Net Mobile
    Replies:
    0
    Views:
    154
    Joaquim Raurell Martí
    Jul 21, 2003
  4. steph

    asp.net 1.1 device adapter source code

    steph, Oct 15, 2003, in forum: ASP .Net Mobile
    Replies:
    0
    Views:
    124
    steph
    Oct 15, 2003
  5. Matt
    Replies:
    0
    Views:
    468
Loading...

Share This Page