Sending WAP Site feedback from Mobile Phone

Description

The WAP (Wireless Application protocol) is the leading standard for information services on wireless terminals like digital mobile phones The WAP standard is based on Internet standards such as HTML, XML and TCP/IP. It consists of a WML language specification, a WMLScript specification, and a Wireless Telephony Application Interface (WTAI) specification.

Equation

WAP = WML (Wireless Mark-up Language) + JavaScript

This article presents developing mobile (Wireless) Web application using  .NET and C#.

Using Visual Studio .NET, you will be able to develop Mobile Web applications easily. Microsoft has integrated the .NET Mobile Web SDK directly into the Visual Studio .NET environment and makes it easy to create Mobile Web applications.

Here is a simple mobile form feedback, which will store the data into the xml file. Instead of storing user feedbacks directly in to the database, just store into the xml file, this XML file will available for any Application .

User Input Format

Mobile Number     : 982345612
User Name          : venkatesh
Email Address      :
[email protected]
User Comments    : Add more links in Entertainment.  I can n't check my hotmails
in our WAP site.

Output in XML

<? xml version="1.0" ?>
<
Feedback>
<
number>982345612<number>
<
name> venkatesh</name>
<
email> [email protected] </email>
<
comments> Add more links in Entertainment. I can n't check my hotmails in our
WAP site
</comments>
</
Feedback>

Source Code:

<%@ Page Inherits=" System.Web.UI.MobileControls.MobilePage"Language="cs" %>
<%@ Register TagPrefix="mobile"
Namespace
="System.Web.UI.MobileControls"
Assembly
="System.Web.Mobile" %>
<% @Import
Namespace
="System.Web.Mail" %>
<% @Import
Namespace
="System.Xml" %>
<script language="c#" runat="server">
//Writing into XML file
//List of cities
<mobile:Form runat="server" ID="Form1" NAME="Form1">
<mobile:Label runat="server" ID="Label1" NAME="Label1">
Select a City
</mobile:Label>
<mobile:List runat="server" id="Listcityvalue"OnItemCommand="List_ClickEventHandler" >
<item Text="Auckland" Value="auckland" />
<item Text="Chennai" Value="chennai" />
<item Text="Hong Kong" Value="hongkong" />
<item Text="Mumbai" Value="mumbai" />
<item Text="Malaysia" Value="malaysia" />
<item Text="New Delhi" Value="newdelhi" />
<item Text="New York" Value="newyork" />
<item Text="Sydney" Value="sydney" />
<item Text="Singapore" Value="singapore" />
<item Text="Tokyo" Value="tokyo" />
<item Text="Washington" Value="washington" />
</mobile:List>
</
mobile:Form>
<mobile:Form runat="server" id="SecondForm">
<mobile:Label runat="server" id="WelcomeMessage" />
</
mobile:Form>
<
mobile:Form id="weather" runat = "server">
<mobile:Label runat="server" id="WeatherLabel"/>
</
mobile:Form>
//Source Code Starts
public void Button_OnClick(Object sender, EventArgs e)
{
string feed_backFileName = "c:\\feedback.xml";
XmlTextWriter feedbackWriter =
null;
feedbackWriter =
new XmlTextWriter (feed_backFileName, null);
feedbackWriter.Formatting = Formatting.Indented;
feedbackWriter .Indentation= 6;
feedbackWriter .Namespaces =
false;
feedbackWriter.WriteStartDocument();
feedbackWriter.WriteStartElement("", "Feedback", "");
feedbackWriter.WriteStartElement("", "number", "");
feedbackWriter.WriteString(Mnumber);
feedbackWriter.WriteEndElement();
feedbackWriter.WriteStartElement("", "name", "");
feedbackWriter.WriteString("username");
feedbackWriter.WriteEndElement();
feedbackWriter.WriteStartElement("", "email", "");
feedbackWriter.WriteString("useremail");
feedbackWriter.WriteEndElement();
feedbackWriter.WriteStartElement("", "comments", "");
feedbackWriter.WriteString("usercomm");
feedbackWriter.WriteEndElement();
feedbackWriter.WriteEndElement();
feedbackWriter.Flush();
feedbackMessage.Text = "Thank you for your valuable feedback";
this.ActiveForm = SecondForm;
}
</script>
//Getting User's Input
<mobile:Form runat="server" ID="Form1" NAME="Form1">
<mobile:Label runat="server" ID="Label1" NAME="Label1">
Thank you for taking the time to help us to improve our WAP
service
</mobile:Label>
<mobile:Label runat="server" ID="Label2" NAME="Label2">
Enter your mobile number
</mobile:Label>
<mobile:TextBox runat="server" id="Mnumber" />
<mobile:Label runat="server" ID="Label3" NAME="Label3">
Enter your name
</mobile:Label>
<mobile:TextBox runat="server" id="username" />
<mobile:Label runat="server" ID="Label4" NAME="Label4">
Enter your email address
</mobile:Label>
<mobile:TextBox runat="server" id="useremail" />
<mobile:Label runat="server" ID="Label5" NAME="Label5">
Enter your comments
</mobile:Label>
<mobile:TextBox runat="server" id="usercomm" />
// When User's Click Submit Button
<mobile:Command runat="server" id="Button" OnClick="Button_OnClick" >
Submit
</mobile:Command>
</
mobile:Form>
<mobile:Form runat="server" id="SecondForm">
<mobile:Label runat="server" id="feedbackMessage" />
</
mobile:Form>
//Source Code End


Similar Articles