Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Mobile > Device Filters

Reply
Thread Tools

Device Filters

 
 
John Miller
Guest
Posts: n/a
 
      09-10-2003

I'm working with the Device-Specific Content quickstart
tutorials at
http://samples.gotdotnet.com/MobileQuickStart/
(nh3mssfx2ihebm551zmqjxff)/Default.aspx?
url=doc/DeviceSpecific.aspx

I've added the device filters to system.web element in
the web.config:

<system.web>
<deviceFilters>
<filter name="IsColor" compare="IsColor"
argument="true" />
<filter name="IsPocketIE" compare="Browser"
argument="Pocket IE" />
<filter name="IsHTML" compare="PreferredRenderingMIME"
argument="text/html" />
</deviceFilters>
</system.web>

and I've added device specific elements to an aspx page:

<mobile:Label runat="server" >
<DeviceSpecific>
<Choice Filter="IsPocketIE" Text="Running on Pocket
IE" />
<Choice Filter="IsHTML" Text="Running on other HTML
device" />
<Choice Text="Running on other device" />
</DeviceSpecific>
<mobile:Label>

When I build and run I get the error:

Can find neither a device capability named 'IsHTML32' nor
a public non-static method on the page named 'IsHTML32'
that returns a System.Boolean and takes
System.Web.Mobile.MobileCapabilities and System.String as
arguments.

What am I missing?

jMM
 
Reply With Quote
 
 
 
 
Lewis Wang [MSFT]
Guest
Posts: n/a
 
      09-12-2003
Hi John,

Thank you for your update. You may change "IsColor" to "isColor". Does it
work?

Hope this helps.

Best regards,
Lewis
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
| Content-Class: urn:content-classes:message
| From: "John Miller" <>
| Sender: "John Miller" <>
| References: <0bed01c377bf$ab6ad4f0$>
<>
| Subject: RE: Device Filters
| Date: Thu, 11 Sep 2003 10:50:13 -0700
| Lines: 135
| Message-ID: <093f01c3788d$26fc80f0$>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Thread-Index: AcN4jSb62UYwbVyzT8y9Y2kmNsCcRg==
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Newsgroups: microsoft.public.dotnet.framework.aspnet.mobile
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.aspnet.mobile:62 29
| NNTP-Posting-Host: TK2MSFTNGXA08 10.40.1.160
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.mobile
|
|
| Hi Lewis,
|
| I added the method and it solved the problem. Thanks for
| the help.
|
| The Choice Element help topic states that "When
| evaluating the Choice element, a check is made to
| determine whether a method of the appropriate signature
| exists on the page. If not the <devicefilters> section of
| web.config is checked."
|
| It seems as if this check isn't being made and the page
| errors out before the web.config is checked.
|
| What do I need to do to be able to define the filters in
| the web.config.
|
| jMM
|
|
| >-----Original Message-----
| >Hi John,
| >
| >You may define public methods for the filters. For
| example:
| >
| >public bool IsHTML(System.Web.Mobile.MobileCapabilities
| capabilities,
| >String optionalArgument)
| >{
| > return true;
| >}
| >
| >When a device requests the page, the framework checks
| each defined <Choice>
| >tag in order. For each choice, it tests the filter
| specified by the filter
| >attribute. If the filter return true, that choice is
| picked.
| >
| >Please check the following link for more information.
| ><Choice> Element
| >http://msdn.microsoft.com/library/default.asp?
| url=/library/en-us/mwsdk/html/
| >mwlrfchoiceelement.asp
| >
| >Hope this helps.
| >
| >Best regards,
| >Lewis
| >This posting is provided "AS IS" with no warranties, and
| confers no rights.
| >
| >--------------------
| >| Content-Class: urn:content-classes:message
| >| From: "John Miller" <>
| >| Sender: "John Miller" <>
| >| Subject: Device Filters
| >| Date: Wed, 10 Sep 2003 10:19:19 -0700
| >| Lines: 44
| >| Message-ID: <0bed01c377bf$ab6ad4f0$>
| >| MIME-Version: 1.0
| >| Content-Type: text/plain;
| >| charset="iso-8859-1"
| >| Content-Transfer-Encoding: 7bit
| >| X-Newsreader: Microsoft CDO for Windows 2000
| >| X-MimeOLE: Produced By Microsoft MimeOLE
| V5.50.4910.0300
| >| Thread-Index: AcN3v6tqbxfRfNgfSV6tYQeagQ30zQ==
| >| Newsgroups:
| microsoft.public.dotnet.framework.aspnet.mobile
| >| Path: cpmsftngxa06.phx.gbl
| >| Xref: cpmsftngxa06.phx.gbl
| >microsoft.public.dotnet.framework.aspnet.mobile:6 215
| >| NNTP-Posting-Host: TK2MSFTNGXA14 10.40.1.166
| >| X-Tomcat-NG:
| microsoft.public.dotnet.framework.aspnet.mobile
| >|
| >|
| >| I'm working with the Device-Specific Content
| quickstart
| >| tutorials at
| >| http://samples.gotdotnet.com/MobileQuickStart/
| >| (nh3mssfx2ihebm551zmqjxff)/Default.aspx?
| >| url=doc/DeviceSpecific.aspx
| >|
| >| I've added the device filters to system.web element in
| >| the web.config:
| >|
| >| <system.web>
| >| <deviceFilters>
| >| <filter name="IsColor" compare="IsColor"
| >| argument="true" />
| >| <filter name="IsPocketIE" compare="Browser"
| >| argument="Pocket IE" />
| >| <filter name="IsHTML"
| compare="PreferredRenderingMIME"
| >| argument="text/html" />
| >| </deviceFilters>
| >| </system.web>
| >|
| >| and I've added device specific elements to an aspx
| page:
| >|
| >| <mobile:Label runat="server" >
| >| <DeviceSpecific>
| >| <Choice Filter="IsPocketIE" Text="Running on
| Pocket
| >| IE" />
| >| <Choice Filter="IsHTML" Text="Running on other
| HTML
| >| device" />
| >| <Choice Text="Running on other device" />
| >| </DeviceSpecific>
| >| <mobile:Label>
| >|
| >| When I build and run I get the error:
| >|
| >| Can find neither a device capability named 'IsHTML32'
| nor
| >| a public non-static method on the page
| named 'IsHTML32'
| >| that returns a System.Boolean and takes
| >| System.Web.Mobile.MobileCapabilities and System.String
| as
| >| arguments.
| >|
| >| What am I missing?
| >|
| >| jMM
| >|
| >
| >.
| >
|

 
Reply With Quote
 
 
 
 
John Miller
Guest
Posts: n/a
 
      09-12-2003
Hi Lewis,

No, changing the case doesn't help. It looks to me like
the <deviceFilters> element in the web.config is not
being read.

jMM

>-----Original Message-----
>Hi John,
>
>Thank you for your update. You may change "IsColor"

to "isColor". Does it
>work?
>
>Hope this helps.
>
>Best regards,
>Lewis
>This posting is provided "AS IS" with no warranties, and

confers no rights.
>
>--------------------
>| Content-Class: urn:content-classes:message
>| From: "John Miller" <>
>| Sender: "John Miller" <>
>| References: <0bed01c377bf$ab6ad4f0$>
><>
>| Subject: RE: Device Filters
>| Date: Thu, 11 Sep 2003 10:50:13 -0700
>| Lines: 135
>| Message-ID: <093f01c3788d$26fc80f0$>
>| MIME-Version: 1.0
>| Content-Type: text/plain;
>| charset="iso-8859-1"
>| Content-Transfer-Encoding: 7bit
>| X-Newsreader: Microsoft CDO for Windows 2000
>| Thread-Index: AcN4jSb62UYwbVyzT8y9Y2kmNsCcRg==
>| X-MimeOLE: Produced By Microsoft MimeOLE

V5.50.4910.0300
>| Newsgroups:

microsoft.public.dotnet.framework.aspnet.mobile
>| Path: cpmsftngxa06.phx.gbl
>| Xref: cpmsftngxa06.phx.gbl
>microsoft.public.dotnet.framework.aspnet.mobile:6 229
>| NNTP-Posting-Host: TK2MSFTNGXA08 10.40.1.160
>| X-Tomcat-NG:

microsoft.public.dotnet.framework.aspnet.mobile
>|
>|
>| Hi Lewis,
>|
>| I added the method and it solved the problem. Thanks

for
>| the help.
>|
>| The Choice Element help topic states that "When
>| evaluating the Choice element, a check is made to
>| determine whether a method of the appropriate

signature
>| exists on the page. If not the <devicefilters> section

of
>| web.config is checked."
>|
>| It seems as if this check isn't being made and the

page
>| errors out before the web.config is checked.
>|
>| What do I need to do to be able to define the filters

in
>| the web.config.
>|
>| jMM
>|
>|
>| >-----Original Message-----
>| >Hi John,
>| >
>| >You may define public methods for the filters. For
>| example:
>| >
>| >public bool IsHTML

(System.Web.Mobile.MobileCapabilities
>| capabilities,
>| >String optionalArgument)
>| >{
>| > return true;
>| >}
>| >
>| >When a device requests the page, the framework checks
>| each defined <Choice>
>| >tag in order. For each choice, it tests the filter
>| specified by the filter
>| >attribute. If the filter return true, that choice is
>| picked.
>| >
>| >Please check the following link for more information.
>| ><Choice> Element
>| >http://msdn.microsoft.com/library/default.asp?
>| url=/library/en-us/mwsdk/html/
>| >mwlrfchoiceelement.asp
>| >
>| >Hope this helps.
>| >
>| >Best regards,
>| >Lewis
>| >This posting is provided "AS IS" with no warranties,

and
>| confers no rights.
>| >
>| >--------------------
>| >| Content-Class: urn:content-classes:message
>| >| From: "John Miller" <>
>| >| Sender: "John Miller" <>
>| >| Subject: Device Filters
>| >| Date: Wed, 10 Sep 2003 10:19:19 -0700
>| >| Lines: 44
>| >| Message-ID: <0bed01c377bf$ab6ad4f0$>
>| >| MIME-Version: 1.0
>| >| Content-Type: text/plain;
>| >| charset="iso-8859-1"
>| >| Content-Transfer-Encoding: 7bit
>| >| X-Newsreader: Microsoft CDO for Windows 2000
>| >| X-MimeOLE: Produced By Microsoft MimeOLE
>| V5.50.4910.0300
>| >| Thread-Index: AcN3v6tqbxfRfNgfSV6tYQeagQ30zQ==
>| >| Newsgroups:
>| microsoft.public.dotnet.framework.aspnet.mobile
>| >| Path: cpmsftngxa06.phx.gbl
>| >| Xref: cpmsftngxa06.phx.gbl
>| >microsoft.public.dotnet.framework.aspnet.mobile:6 215
>| >| NNTP-Posting-Host: TK2MSFTNGXA14 10.40.1.166
>| >| X-Tomcat-NG:
>| microsoft.public.dotnet.framework.aspnet.mobile
>| >|
>| >|
>| >| I'm working with the Device-Specific Content
>| quickstart
>| >| tutorials at
>| >| http://samples.gotdotnet.com/MobileQuickStart/
>| >| (nh3mssfx2ihebm551zmqjxff)/Default.aspx?
>| >| url=doc/DeviceSpecific.aspx
>| >|
>| >| I've added the device filters to system.web element

in
>| >| the web.config:
>| >|
>| >| <system.web>
>| >| <deviceFilters>
>| >| <filter name="IsColor" compare="IsColor"
>| >| argument="true" />
>| >| <filter name="IsPocketIE" compare="Browser"
>| >| argument="Pocket IE" />
>| >| <filter name="IsHTML"
>| compare="PreferredRenderingMIME"
>| >| argument="text/html" />
>| >| </deviceFilters>
>| >| </system.web>
>| >|
>| >| and I've added device specific elements to an aspx
>| page:
>| >|
>| >| <mobile:Label runat="server" >
>| >| <DeviceSpecific>
>| >| <Choice Filter="IsPocketIE" Text="Running on
>| Pocket
>| >| IE" />
>| >| <Choice Filter="IsHTML" Text="Running on other
>| HTML
>| >| device" />
>| >| <Choice Text="Running on other device" />
>| >| </DeviceSpecific>
>| >| <mobile:Label>
>| >|
>| >| When I build and run I get the error:
>| >|
>| >| Can find neither a device capability

named 'IsHTML32'
>| nor
>| >| a public non-static method on the page
>| named 'IsHTML32'
>| >| that returns a System.Boolean and takes
>| >| System.Web.Mobile.MobileCapabilities and

System.String
>| as
>| >| arguments.
>| >|
>| >| What am I missing?
>| >|
>| >| jMM
>| >|
>| >
>| >.
>| >
>|
>
>.
>

 
Reply With Quote
 
Earl Beaman[MS]
Guest
Posts: n/a
 
      09-17-2003
Hi Guys,

I believe that this error is due to the fact that you have a filter named
the same thing as the compare attribute. Try using a different filter
name, such as supportsColor or hasColor or something similar.

This error is easily reproducible with similar types of filters. For
example, this one will produce the same error as well.

<filter name="PreferredRenderingMime" compare="PreferredRenderingMime"
argument="text/html" />

A better name for this is "isHTML", and that will not cause an error. But
the above will.

Also, these values are definitely being read out of the web.config.

Thanks,
Earl Beaman
Microsoft, ASP.NET

This posting is provided "AS IS", with no warranties, and confers no
rights.


 
Reply With Quote
 
Earl Beaman[MS]
Guest
Posts: n/a
 
      09-18-2003
I did some more research on this issue, and the reason for the error is
that there is an implicit filter created for every device capability, such
as IsColor. When you add a new filter with that name, you basically end up
with name collisions.
To get around the issue, you do need to use filters with different names
then the capabilities already established.

Thanks,
Earl Beaman
Microsoft, ASP.NET

This posting is provided "AS IS", with no warranties, and confers no
rights.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Stacked polariser filters instead of ND filters? peter Digital Photography 5 12-13-2010 10:25 PM
using the Filters DLL (image filters) Dieter Vanderelst Python 1 02-15-2006 09:56 AM
802.11g router / 1 x 802.11b device / 1 x 802.11g device Oli Wireless Networking 3 09-27-2004 11:56 PM
Canon: EF filters = EF-S filters? [blu|shark] Digital Photography 17 01-28-2004 10:04 AM
Hrlp with Mobile Device Filters Victor J. Servin ASP .Net Mobile 1 12-08-2003 06:57 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57