Asked by:
Can find neither a device capability named 'IsHtml'

Question
-
User-30447372 posted
Hi Guys,
I am using .net 1.1 and working on mobile aspx page. When I put following code, I am getting "Can find neither a device capability named 'IsHtml' nor a public non-static method on the page named 'IsHtml' that returns a System.Boolean and takes System.Web.Mobile.MobileCapabilities and System.String as arguments."
<body Xmlns:mobile="http://schemas.microsoft.com/Mobile/WebForm">
<mobile:Form id="Form1" runat="server">
<mobile:DeviceSpecific id="device1" Runat="server">
<Choice Filter="IsHtml">
<HeaderTemplate>
<asp:Table ID="tb1" Runat="server">
<asp:TableRow ID="tr1" Runat="server">
<asp:TableCell ID="tc1" Runat="server">
Hi
</asp:TableCell>
</asp:TableRow>
</asp:Table>
</HeaderTemplate>
</Choice>
</mobile:DeviceSpecific>
</mobile:Form>
</body>I have tried <Choice Filter="IsHtml"> & <Choice Filter="IsHtml32"> & <Choice Filter="IsWML11">. I have tested on regular web-browser + Microsoft mobile explorer 3.0.
I think I am missing something, but I can not find out. Ur help is required. Thx.
Wednesday, December 13, 2006 8:57 PM
All replies
-
User-225480610 posted
Do you have a device filter called IsHtml defined in your web.config file?Tuesday, January 2, 2007 8:15 AM -
User-2050545975 posted
hi
even i'm also facing the same problem
web.config file has device filters
<deviceFilters>
<filter name="isJPhone" compare="Type" argument="J-Phone"/>
<filter name="isHTML32" compare="PreferredRenderingType" argument="html32"/>
<filter name="isWML11" compare="PreferredRenderingType" argument="wml11"/>
<filter name="isCHTML10" compare="PreferredRenderingType" argument="chtml10"/>
<filter name="isGoAmerica" compare="Browser" argument="Go.Web"/>
<filter name="isMME" compare="Browser" argument="Microsoft Mobile Explorer"/>
<filter name="isMyPalm" compare="Browser" argument="MyPalm"/>
<filter name="isPocketIE" compare="Browser" argument="Pocket IE"/>
<filter name="isUP3x" compare="Type" argument="Phone.com 3.x Browser"/>
<filter name="isUP4x" compare="Type" argument="Phone.com 4.x Browser"/>
<filter name="isEricssonR380" compare="Type" argument="Ericsson R380"/>
<filter name="isNokia7110" compare="Type" argument="Nokia 7110"/>
<filter name="prefersGIF" compare="PreferredImageMIME" argument="image/gif"/>
<filter name="prefersBmp" compare="PreferredImageMIME" argument="image/bmp"/>
<filter name="prefersWBMP" compare="PreferredImageMIME" argument="image/vnd.wap.wbmp"/>
<filter name="supportsColor" compare="IsColor" argument="true"/>
<filter name="supportsCookies" compare="Cookies" argument="true"/>
<filter name="supportsJavaScript" compare="Javascript" argument="true"/>
<filter name="supportsVoiceCalls" compare="CanInitiateVoiceCall" argument="true"/>
</deviceFilters>these are the filters it has
this is the code
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="emailPage.aspx.cs" Inherits="wapSamples_emailPage" %>
<%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %>
<%@ Register TagPrefix="SMTP" Namespace="wapacmemenu" Assembly="wapacmemenu" %>
<html xmlns="http://www.w3.org/1999/xhtml" >
<body>
<mobile:StyleSheet id="ss1" runat="server">
<PagerStyle Font-Name="Verdana" Name="FromStyle" BackColor="#80FFFF"></PagerStyle>
</mobile:StyleSheet>
<mobile:Form id="frmWelcome" runat="server" StyleReference="FromStyle">
Testing the SMTP Control<br/>
<mobile:Link ID="Link1" runat="server" NavigateUrl="#frmDefault">Default SMTP Control</mobile:Link>
<mobile:Link ID="Link2" runat="server" NavigateUrl="#frmStyle">Applying Styles to the control</mobile:Link>
<mobile:Link ID="Link3" runat="server" NavigateUrl="#frmDeviceSpecific">Applying Device Specific to the control</mobile:Link>
</mobile:Form>
<%-- basic usage of the SMTP control. Note that you have to put in a valid SMTPServer for you
network (true for all instances of this control) --%>
<mobile:Form id="frmDefault" runat="server">
<SMTP:MobileSMTPControl Runat="server"
SMTPServerName="SmartHost"
OnMessageSent="SMTP_MessageSent"/>
</mobile:Form>
<%-- Shows the SMTP control inheriting a style. --%>
<mobile:Form id="frmStyle" runat="Server" StyleReference="FromStyle">
<SMTP:MobileSmtpControl runat="Server"
SMTPServerName="SmartHost"
OnMessageSent="SMTP_MessageSent"/>
</mobile:Form>
<%-- Shows fields optionally made disabled, with additional fields disabled on
a per-device-type basis. --%>
<mobile:Form id="frmDeviceSpecific" runat="server" StyleReference="FromStyle">
<SMTP:MobileSmtpControl runat="Server"
SMTPServerName="SmartHost"
VisibleBcc="false"
OnMessageSent="SMTP_MessageSent">
<DeviceSpecific>
<choice filter="IsWML11" VisiblePriority="false" VisibleCc="false" />
</DeviceSpecific>
</SMTP:MobileSmtpControl>
</mobile:Form>
<mobile:Form id="frmMessageSent" runat="server" StyleReference="FromStyle">
<mobile:Label id="lblMsgSent" runat="server"/>
<mobile:Link ID="Link4" runat="server" NavigateURL="#frmWelcome">Back to Start Page</mobile:Link>
</mobile:Form>
</body>
</html>
when i run the application its giving the same error
Can find neither a device capability named 'IsWML11' nor a public non-static method on the page named 'IsWML11' that returns a System.Boolean and takes System.Web.Mobile.MobileCapabilities and System.String as arguments.
how to fix this?
thanks in advance
archu
Friday, October 19, 2007 3:20 AM -
User-225480610 posted
In your web.config you have filter name isWML11 but in your code you have IsWML11. Filter names are case sensitive AFAIK.
Friday, October 19, 2007 4:10 AM -
User-2050545975 posted
i hav changed that
after registering the assembly ,it showing only timer,menu classes it's not showing the email class that is
<smtp:MobileSMTPControl>
when i run the application its giving error
<input name="__EVENTTARGET" type="hidden"> <input name="__EVENTARGUMENT" type="hidden"> <script language="javascript"><!-- function __doPostBack(target, argument){ var theform = document.frmMessageSent theform.__EVENTTARGET.value = target theform.__EVENTARGUMENT.value = argument theform.submit() } // --> </script> Could not sent your email due to the following reason : 'Mailbox unavailable. The server response was: 5.7.1 Unable to relay for archu@xyz.com'
this is my MobileSMTPControl class
using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
//using System.Web.Mail;
using System.Web.UI;
using System.Web.UI.MobileControls;
using System.Net;
using System.Net.Mail;
namespace wapacmemenu
{
public class MobileSMTPControl : MobileControl, INamingContainer
{
/// <summary>
/// Set or get the SMTP server that the message will be sent to
/// </summary>
public String SmtpServerName
{
get
{
return (String)ViewState["SmtpServerName"];
}
set
{
ViewState["SmtpServerName"] = value;
}
}
/// <summary>
/// Get or set the destination SMTP Address of the message.
/// this String needs to follow the SMTP Address schema
/// </summary>
public String MessageTo
{
get
{
String str = (String)ViewState["MessageTo"];
return str == null ? String.Empty : str;
}
set
{
ViewState["MessageTo"] = value;
}
}
/// <summary>
/// Get or set the source of the E-Mail Message.
/// </summary>
public String MessageFrom
{
get
{
String str = (String)ViewState["MessageFrom"];
return str == null ? String.Empty : str;
}
set
{
ViewState["MessageFrom"] = value;
}
}
/// <summary>
/// Get or set a destination SMTP Address of the message.
/// the adress or addressses entered will be in the Cc field of the e-mail message
/// this String needs to follow the SMTP Address RFC
/// </summary>
public String MessageCc
{
get
{
String str = (String)ViewState["MessageCc"];
return str == null ? String.Empty : str;
}
set
{
ViewState["MessageCc"] = value;
}
}
/// <summary>
/// Get or set a destination SMTP Address of the message.
/// the adress or addressses entered will be in the Bcc field of the e-mail message
/// this String needs to follow the SMTP Address RFC
/// </summary>
public String MessageBcc
{
get
{
String str = (String)ViewState["MessageBcc"];
return str == null ? String.Empty : str;
}
set
{
ViewState["MessageBcc"] = value;
}
}
/// <summary>
/// Get or set the Subject of the email message
/// </summary>
public String MessageSubject
{
get
{
String str = (String)ViewState["MessageSubject"];
return str == null ? String.Empty : str;
}
set
{
ViewState["MessageSubject"] = value;
}
}
/// <summary>
/// Get or set the Body of the email message
/// </summary>
public String MessageBody
{
get
{
String str = (String)ViewState["MessageBody"];
return str == null ? String.Empty : str;
}
set
{
ViewState["MessageBody"] = value;
}
}
/// <summary>
/// Get or Set the option of making visible the Cc field
/// to the end user.
/// </summary>
private bool _visibleCc = true;
public bool VisibleCc
{
get
{
return _visibleCc;
}
set
{
_visibleCc = value;
}
}
/// <summary>
/// Get or Set the option of making visible the BCc field
/// to the end user
/// </summary>
private bool _visibleBcc = true;
public bool VisibleBcc
{
get
{
return _visibleBcc;
}
set
{
_visibleBcc = value;
}
}
/// <summary>
/// Get or Set the option of making visible the From field
/// to the end user
/// </summary>
private bool _visibleFrom = true;
public bool VisibleFrom
{
get
{
return _visibleFrom;
}
set
{
_visibleFrom = value;
}
}
/// <summary>
/// Get or Set the option of making visible the Priority field
/// to the end user
/// </summary>
private bool _visiblePriority = true;
public bool VisiblePriority
{
get
{
return _visiblePriority;
}
set
{
_visiblePriority = value;
}
}
/// <summary>
/// Get or Set the Priority of the Email Message
/// </summary>
public String MessagePriority
{
get
{
MailPriority mailPriority = (MailPriority)ViewState["MessagePriority"];
if (mailPriority.Equals(MailPriority.High))
{
return ("High");
}
else if (mailPriority.Equals(MailPriority.Low))
{
return ("Low");
}
return ("Normal");
}
set
{
switch (value)
{
case ("High"):
ViewState["MessagePriority"] =MailPriority.High;
break;
case ("Low"):
ViewState["MessagePriority"] = MailPriority.Low;
break;
case ("Normal"):
default:
ViewState["MessagePriority"] = MailPriority.Normal;
break;
}
}
}
/// <summary>
/// Get or Set the Priority of the Email Message
/// This is an internal interface to be use by the send email function
/// </summary>
public MailPriority MsgPriority
{
get
{
return ((MailPriority)ViewState["MessagePriority"]);
}
set
{
switch (value)
{
case (MailPriority.High):
ViewState["MessagePriority"] = MailPriority.High;
break;
case (MailPriority.Low):
ViewState["MessagePriority"] = MailPriority.Low;
break;
case (MailPriority.Normal):
default:
ViewState["MessagePriority"] = MailPriority.Normal;
break;
}
}
}
/// <summary>
/// This function overilde the CreateChildControl function
/// - Initialize each control with the value set in the properties (if applicable)
/// - Hide or display the control base on the property settings
/// - Add the control to the controiner
/// - Set the ChildControlsCreated = true;
/// NOTE: the control are created when the class in instatiated
/// </summary>
protected override void CreateChildControls()
{
// TO Section
_lblMsgTo.ID = "lblMsgTo";
_lblMsgTo.Text = "To:";
_txtMsgTo.ID = "txtMsgTo";
_txtMsgTo.Text = MessageTo;
_reqMsgTo.ControlToValidate = _txtMsgTo.ID;
_reqMsgTo.Text = "Must fill in the To: field";
this.Controls.Add(_reqMsgTo);
this.Controls.Add(_lblMsgTo);
this.Controls.Add(_txtMsgTo);
// From Section
_lblMsgFrom.ID = "lblMsgFrom";
_lblMsgFrom.Text = "From:";
_lblMsgFrom.Visible = VisibleFrom;
_txtMsgFrom.ID = "txtMsgFrom";
_txtMsgFrom.Text = MessageFrom;
_txtMsgFrom.Visible = VisibleFrom;
_reqMsgFrom.ControlToValidate = _txtMsgFrom.ID;
_reqMsgFrom.Text = "Must fill in the From: field";
_reqMsgFrom.Visible = VisibleFrom;
this.Controls.Add(_reqMsgFrom);
this.Controls.Add(_lblMsgFrom);
this.Controls.Add(_txtMsgFrom);
// Cc Section
_lblMsgCc.ID = "lblMsgCc";
_lblMsgCc.Text = "CC:";
_lblMsgCc.Visible = VisibleCc;
this.Controls.Add(_lblMsgCc);
_txtMsgCc.ID = "txtMsgCc";
_txtMsgCc.Visible = VisibleCc;
_txtMsgCc.Text = MessageCc;
this.Controls.Add(_txtMsgCc);
// Bcc Section
_lblMsgBcc.ID = "lblMsgBcc";
_lblMsgBcc.Text = "Bcc:";
_lblMsgBcc.Visible = VisibleBcc;
this.Controls.Add(_lblMsgBcc);
_txtMsgBcc.ID = "txtMsgBBcc";
_txtMsgBcc.Visible = VisibleBcc;
_txtMsgBcc.Text = MessageBcc;
this.Controls.Add(_txtMsgBcc);
// SUBJECT Section
_lblMsgSubject.ID = "lblMsgSubject";
_lblMsgSubject.Text = "Subject:";
this.Controls.Add(_lblMsgSubject);
_txtMsgSubject.ID = "txtMsgSubject";
_txtMsgSubject.Text = "MessageSubject";
this.Controls.Add(_txtMsgSubject);
// BODY Section
_lblMsgBody.ID = "lblMsgBody";
_lblMsgBody.Text = "Body:";
this.Controls.Add(_lblMsgBody);
_txtMsgBody.ID = "txtMsgBody";
_txtMsgBody.Text = MessageBody;
this.Controls.Add(_txtMsgBody);
// PRIORITY Section
_lblMsgPriority.ID = "lblMsgPriority";
_lblMsgPriority.Text = "Priority:";
_lblMsgPriority.Visible = VisiblePriority;
this.Controls.Add(_lblMsgPriority);
_slstMsgPriority.ID = "slstMsgPriority";
// add the option for the prioirty control (High, Normal, Low)
_slstMsgPriority.Items.Add("High");
_slstMsgPriority.Items.Add("Normal");
_slstMsgPriority.Items.Add("Low");
_slstMsgPriority.SelectedIndex = 1;
_slstMsgPriority.Visible = VisiblePriority;
this.Controls.Add(_slstMsgPriority);
// empty line created
_lblLine.ID = "lblLine";
this.Controls.Add(_lblLine);
// SEND BUTTON Section
_cmdOk.ID = "cmdOk";
_cmdOk.Text = "Send";
// Subscribe to the OnClick event so it call Send_Function
_cmdOk.Click += new EventHandler(this.Send_Click);
this.Controls.Add(_cmdOk);
//Saving the output
ChildControlsCreated = true;
}
/// <summary>
/// This function gets call after the user have click OK in the Send button
/// - Get the latest values from the postback (enter by the user)
/// - Find the priority settings
/// - Call the internal function call SendMessage to send the message out
/// - Check for any exception case by the SendMessage function
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public void Send_Click(Object sender, EventArgs e)
{
if (!_reqMsgTo.IsValid || !_reqMsgFrom.IsValid)
{
return;
}
if (!_txtMsgTo.Text.Equals(MessageTo))
{
MessageTo = _txtMsgTo.Text;
}
if (!_txtMsgFrom.Text.Equals(MessageFrom))
{
MessageFrom = _txtMsgFrom.Text;
}
if (!_txtMsgCc.Text.Equals(MessageCc))
{
MessageCc = _txtMsgCc.Text;
}
if (!_txtMsgBcc.Text.Equals(MessageBcc))
{
MessageBcc = _txtMsgBcc.Text;
}
if (!_txtMsgSubject.Text.Equals(MessageSubject))
{
MessageSubject = _txtMsgSubject.Text;
}
if (!_txtMsgBody.Text.Equals(MessageBody))
{
MessageBody = _txtMsgBody.Text;
}
int indexSelected = _slstMsgPriority.SelectedIndex;
switch (indexSelected)
{
case 0:
MsgPriority = MailPriority.High;
break;
case 1:
MsgPriority = MailPriority.Normal;
break;
case 2:
MsgPriority = MailPriority.Low;
break;
}
this.SendMessage();
if (_sendMailFailed == true)
{
MessageSentEventArgs msgEventArg = new MessageSentEventArgs(false, _internalException.Message);
OnMessageSent(msgEventArg);
}
else
{
MessageSentEventArgs msgEventArg = new MessageSentEventArgs(true);
OnMessageSent(msgEventArg);
}
}
/// <summary>
/// This function send the E-Mail to the SMTP Server
/// - validate that there is a TO and From set
/// - instanciate the Mail Message object
/// - populate the object with the right information
/// - Send the message
/// - Catch any excption in the case of any proble
/// </summary>
public void SendMessage()
{
if ((this.MessageFrom != null) && (this.MessageTo != null))
{
MailMessage newMailMessage = new MailMessage();
newMailMessage.From = new MailAddress(this.MessageFrom);// this.MessageFrom;
newMailMessage.To.Add(this.MessageTo);
newMailMessage.Priority = this.MsgPriority;
newMailMessage.Body = this.MessageBody;
newMailMessage.Subject = this.MessageSubject;
try
{
SmtpClient SmtpMail = new SmtpClient(this.SmtpServerName,25);
SmtpMail.Send(newMailMessage);
//SmtpMail.SmtpServer = this.SmtpServerName;
//SmtpMail.Send(newMailMessage);
}
catch (Exception e)
{
_internalException = e;
_sendMailFailed = true;
}
}
}
/// <SECTION>
/// EVENTS
/// This section provides the event managment
/// </SECTION>
///
/// <summary>
/// This is the event handler when the message sent
/// </summary>
///
public delegate void MessageSentEventHandler(Object source, MessageSentEventArgs e);
public event MessageSentEventHandler MessageSent;
/// <summary>
///
///
/// </summary>
/// <param name="e"></param>
public void OnMessageSent(MessageSentEventArgs e)
{
if (MessageSent != null)
{
MessageSent(this, e);
}
}
// private fields
Exception _internalException = null;
bool _sendMailFailed = false;
Label _lblMsgTo = new Label();
Label _lblMsgFrom = new Label();
Label _lblMsgCc = new Label();
Label _lblMsgBcc = new Label();
Label _lblMsgSubject = new Label();
Label _lblMsgBody = new Label();
Label _lblMsgPriority = new Label();
Label _lblLine = new Label();
TextBox _txtMsgTo = new TextBox();
TextBox _txtMsgFrom = new TextBox();
TextBox _txtMsgCc = new TextBox();
TextBox _txtMsgBcc = new TextBox();
TextBox _txtMsgSubject = new TextBox();
TextBox _txtMsgBody = new TextBox();
Command _cmdOk = new Command();
RequiredFieldValidator _reqMsgTo = new RequiredFieldValidator();
RequiredFieldValidator _reqMsgFrom = new RequiredFieldValidator();
SelectionList _slstMsgPriority = new SelectionList();
}
public class MessageSentEventArgs : EventArgs
{
String _errorMessage = null;
bool _wasMessageSent = false;
public MessageSentEventArgs(bool wasMessageSent)
{
_wasMessageSent = wasMessageSent;
}
public MessageSentEventArgs(bool wasMessageSent, String newErrorMessage)
{
_errorMessage = newErrorMessage;
}
public String ErrorMessage
{
get
{
return _errorMessage;
}
}
public bool WasMessageSent
{
get
{
return _wasMessageSent;
}
}
}
}where i'm doing wrong?how to fix this ?
thanks in advance
archu
Friday, October 19, 2007 8:55 AM