[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

John Miller

9/10/2003 5:19:00 PM


I'm working with the Device-Specific Content quickstart
tutorials at
http://samples.gotdotnet.com/MobileQ...
(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
4 Answers

v-lwang

9/12/2003 5:46:00 AM

0

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" <jMiller@pdata.com>
| Sender: "John Miller" <jMiller@pdata.com>
| References: <0bed01c377bf$ab6ad4f0$a601280a@phx.gbl>
<8DVxqjGeDHA.1632@cpmsftngxa06.phx.gbl>
| Subject: RE: Device Filters
| Date: Thu, 11 Sep 2003 10:50:13 -0700
| Lines: 135
| Message-ID: <093f01c3788d$26fc80f0$a001280a@phx.gbl>
| 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:6229
| 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/de...
| 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" <jMiller@pdata.com>
| >| Sender: "John Miller" <jMiller@pdata.com>
| >| Subject: Device Filters
| >| Date: Wed, 10 Sep 2003 10:19:19 -0700
| >| Lines: 44
| >| Message-ID: <0bed01c377bf$ab6ad4f0$a601280a@phx.gbl>
| >| 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:6215
| >| 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/MobileQ...
| >| (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
| >|
| >
| >.
| >
|

John Miller

9/12/2003 3:53:00 PM

0

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" <jMiller@pdata.com>
>| Sender: "John Miller" <jMiller@pdata.com>
>| References: <0bed01c377bf$ab6ad4f0$a601280a@phx.gbl>
><8DVxqjGeDHA.1632@cpmsftngxa06.phx.gbl>
>| Subject: RE: Device Filters
>| Date: Thu, 11 Sep 2003 10:50:13 -0700
>| Lines: 135
>| Message-ID: <093f01c3788d$26fc80f0$a001280a@phx.gbl>
>| 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:6229
>| 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/de...
>| 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" <jMiller@pdata.com>
>| >| Sender: "John Miller" <jMiller@pdata.com>
>| >| Subject: Device Filters
>| >| Date: Wed, 10 Sep 2003 10:19:19 -0700
>| >| Lines: 44
>| >| Message-ID: <0bed01c377bf$ab6ad4f0$a601280a@phx.gbl>
>| >| 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:6215
>| >| 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/MobileQ...
>| >| (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
>| >|
>| >
>| >.
>| >
>|
>
>.
>

earlb

9/17/2003 12:58:00 AM

0

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.


earlb

9/18/2003 4:44:00 PM

0

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.