Code Examples
  Home arrow Code Examples arrow Generic WebPages Using WAP by Jignesh Desa...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
CODE EXAMPLES

Generic WebPages Using WAP by Jignesh Desai
By: aspfree
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 6
    2000-09-09

    Table of Contents:

    Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT



    Generic WebPages Using WAP




     

    Here I will explain how to implementing WAP to work on traditional browser and Mobile devices using ASP. although I personally feel XML would be the best approach for this kind of work. Well this is my attempt to allow users to access same page from IE, NN, Nokia and UP Browsers.

    Since HTML tags and WML tags are little different in syntax the only common tag I see is <A> anchor tag. you can have graphics when you are displaying on traditional browsers, but i have not done this is my example.

     

    [ Jignesh.asp ]

    <%
    agent = Request.servervariables("http_user_agent")
    if instr(1,agent,"Nokia") or instr(1,agent,"UP/4.0") then
    Response.ContentType = "text/vnd.wap.wml"
    Response.write("<?xml version=""1.0""?><!DOCTYPE wml PUBLIC""-//WAPFORUM//DTD WML 1.1//EN""""http://www.wapforum.org/DTD/wml_1.1.xml"">")
    Response.write("<wml><card>")
    else
    Response.ContentType = "text/html"
    Response.write "<html><head><title>WAP (WirelessApplication Protocol)</title></head><body>"
    end if

    Response.write "<p align=""center"">Welcome</p>"
    Response.write "<p align=""center"">Jignesh consultancy</p>"
    Response.write "<p><a href=""training.asp""> Training </a></p>"
    Response.write "<p><a href=""webd.asp""> Web Development </a></p>"
    Response.write "<p><a href=""Home.asp""> Jignesh's Home </a></p>"
    Response.write "<p>Email: codehunt@yahoo.com</p>"
    if instr(1,agent,"Nokia") or instr(1,agent,"UP/4.0") then
    Response.write("</card></wml>")
    else
    response.write "</body></html>"
    end if
    %>

    Things are pretty simple here Request.servervariables("http_user_agent") will return what browser "client" is using. if you run this code on Nokia toolkit it returns "Nokia-WAP-Toolkit/1.3beta" while UP. Browser returns "UPG1 UP/4.0.4g". so we well find out what is the value of 'agent' variable, if it is matching above two we will throw WML contant from asp file else assume client is a traditional browser and we will throw HTML content.

    you might wonder why I am using </p> tag in every statement and not <br>. the answer is as per WML specification empty tags syntax is "<br/> which is perfectly fine for IE but not for NN (atleast ver 4.5 ). if you are planning to support all versions of browser then this is the best.

    This remains same for all other remaining ".asp" files in this article. source code of other .asp files are listed below.

     

    [ Training.asp ]

    <%
    agent = Request.servervariables("http_user_agent")
    if instr(1,agent,"Nokia") or instr(1,agent,"UP/4.0") then
    Response.ContentType = "text/vnd.wap.wml"
    Response.write("<?xml version=""1.0""?><!DOCTYPE wml PUBLIC""-//WAPFORUM//DTD WML 1.1//EN""""http://www.wapforum.org/DTD/wml_1.1.xml"">")
    Response.write("<wml><card>")
    Response.write("<do type=""accept"" label=""Go!"" optional=""false"" >")
    Response.write("<prev/></do>")
    else
    Response.ContentType = "text/html"
    Response.write "<html><head><title>WAP (WirelessApplication Protocol)</title></head><body>"
    end if

    Response.write "<p align=""center"">Welcome</p>"
    Response.write "<p align=""center"">Jignesh consultancy</p>"
    Response.write "<p>Higher End Training on Site Server, WAP, ASP-IIS, Oracle8i.</p>"
    Response.write "<p> (091)-(022)-(8638399) </p>"
    if instr(1,agent,"Nokia") or instr(1,agent,"UP/4.0") then
    Response.write("</card></wml>")
    else
    response.write "</body></html>"
    end if
    %>


    [ WebD.asp ]

    <%
    agent = Request.servervariables("http_user_agent")
    if instr(1,agent,"Nokia") or instr(1,agent,"UP/4.0") then
    Response.ContentType = "text/vnd.wap.wml"
    Response.write("<?xml version=""1.0""?><!DOCTYPE wml PUBLIC""-//WAPFORUM//DTD WML 1.1//EN""""http://www.wapforum.org/DTD/wml_1.1.xml"">")
    Response.write("<wml><card>")
    Response.write("<do type=""accept"" label=""Go!"" optional=""false"" >")
    Response.write("<prev/></do>")
    else
    Response.ContentType = "text/html"
    Response.write "<html><head><title>WAP (WirelessApplication Protocol)</title></head><body>"
    end if

    Response.write "<p align=""center"">Welcome</p>"
    Response.write "<p align=""center"">Jignesh consultancy</p>"
    Response.write "<p>[ Web Development Rs.300 and Hosting with fast servers] </p>"
    Response.write "<p> (091)-(022)-(8638399) </p>"
    if instr(1,agent,"Nokia") or instr(1,agent,"UP/4.0") then
    Response.write("</card></wml>")
    else
    response.write "</body></html>"
    end if
    %>


    [ Home.asp ]

    <%
    agent = Request.servervariables("http_user_agent")
    if instr(1,agent,"Nokia") or instr(1,agent,"UP/4.0") then
    Response.ContentType = "text/vnd.wap.wml"
    Response.write("<?xml version=""1.0""?><!DOCTYPE wml PUBLIC""-//WAPFORUM//DTD WML 1.1//EN""""http://www.wapforum.org/DTD/wml_1.1.xml"">")
    Response.write("<wml><card>")
    Response.write("<do type=""accept"" label=""Go!"" optional=""false"" >")
    Response.write("<prev/></do>")
    else
    Response.ContentType = "text/html"
    Response.write "<html><head><title>WAP (WirelessApplication Protocol)</title></head><body>"
    end if

    Response.write "<p align=""center"">Welcome</p>"
    Response.write "<p align=""center"">Jignesh consultancy</p>"
    Response.write "<p>C/204 Patel Nagar, 4.M.G. Cross Road, Kandivali (west), Mumbai 400067, India</p>"
    Response.write "<p> (091)-(022)-(8638399) </p>"
    if instr(1,agent,"Nokia") or instr(1,agent,"UP/4.0") then
    Response.write("</card></wml>")
    else
    response.write "</body></html>"
    end if
    %>


    That's it!. Enjoy and download code to see live. or check live from your simulator by pointing here

    http://www.web-tech.atfreeweb.com/default.asp

    See my other article "Booking Movie Tickets on Mobile Phone"


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

    More Code Examples Articles
    More By aspfree

     

    IBM® developerWorks developerWorks - FREE Tools!


    NEW! IBM – Taking Web 2.0 to Work

    David Barnes, Lead Evangelist for IBM Emerging Internet Technologies will discuss aspects of Web 2.0 that bring value to corporations, academia, and government. He'll also discuss IBM's vision around Web 2.0, including the importance of remixability and consumability. The discussion will culminate with examples of various IBM Software Group solutions you can use to get ahead of the Web 2.0 adoption curve.
    FREE! Go There Now!


    NEW! Evaluate WebSphere Extended Deployment Compute Grid V6.1

    Visit IBM developerWorks to download a free trial version of WebSphere Extended Deployment Compute Grid, which lets you schedule, execute, and monitor batch jobs. Because online transaction processing and batch jobs execute simultaneously on the same server resources, you can avoid costly duplication of resources. Compute Grid supports job types of Java transactional batch, compute-intensive and a new type called "native execution", which enables non-Java workloads to run on distributed end points.
    FREE! Go There Now!


    NEW! Hello World: WebSphere Service Registry and Repository

    Manage, govern, and share services across your organization by using WebSphere Service Registry and Repository. Follow the hands-on exercises to learn how to navigate the Web interface to publish, find, reuse, and update services.
    FREE! Go There Now!


    NEW! Improve your build process with IBM Rational Build Forge, Part 2: Automate builds for a real-world Tomcat project

    Learn how Rational Build Forge can extend a simple compile and package build process by adding customization and deployment capability. Go from a manual method to automating: checking for code changes; getting the latest source; compiling and packaging; customizing; copying to and restarting a deployment server; and sending e-mail notification that a new version is available.
    FREE! Go There Now!


    NEW! Rational Talks to You: Manage RUP-based CMMI initiatives

    Join this Rational Talks to You teleconference on December 4 at 1:00 pm ET to discuss how Rational Method Composer can help meet your compliance objectives. Get your questions answered!
    FREE! Go There Now!


    NEW! Trial download: IBM Rational Manual Tester V7.0.1

    Try the latest version of IBM Rational Manual Tester V7.0.1 by downloading a free trial from IBM developerWorks. This manual test authoring and execution tool promotes test step reuse to reduce the impact of software change on testers and business analysts and addresses the needs of teams performing at least a portion of their testing manually.
    FREE! Go There Now!


    NEW! Trial download: IBM Rational Performance Tester V7.0.1

    Get a free trial download of the latest version of IBM Rational Performance Tester V7.0.1, a load and performance testing solution for teams concerned about the scalability of their Web-based applications. Combining multiple ease-of-use features with granular detail, Rational Performance Tester simplifies the test-creation, load-generation and data-collection processes that help teams ensure the ability of their applications to accommodate required user loads.
    FREE! Go There Now!


    NEW! Webcast: Calling All Testers! Find Application Vulnerabilities Early in the Development Process Where they are Easier to Fix and Less Risky to your Business

    In this webcast, IBM Rational will discuss the importance of Web application security and will share techniques and best practices to introduce application security testing into current QA processes including: understanding common security vulnerabilities and techniques to integrate security testing with defect tracking and remediation systems in an effort to safeguard sensitive online information.
    FREE! Go There Now!


    NEW! Webcast: Eclipse: Empowering the universal platform

    The Eclipse community is constantly working to extend Eclipse's functionality. In this webcast, learn about some of the most important and feature-rich projects under development. From multi-language support to plug-in development, tune in to see what Eclipse is capable of now.
    FREE! Go There Now!


    NEW! Webcast: Introducing the new Information Server and Solutions community: LeverageInformation

    User communities play an important role in communication and collaboration around products, solutions and other areas of special interest to members. Successful communities are able to provide the right mix of content and services to deliver a value proposition that resonates with each audience. Join Tom Inman, VP of Marketing for Information and Platform Solutions as he introduces the new LeverageINFORMATION community. During this webcast, learn about the value provided by the community and how customers and partners derive value from the community in addressing their own technical and business challenges.
    FREE! Go There Now!



    All FREE IBM® developerWorks Tools!

    CODE EXAMPLES ARTICLES

    - Bipartite Graphs
    - Connectivity in Graphs
    - The Ford-Fulkerson Algorithm
    - Critical Paths
    - The Bellman-Ford and Roy-Floyd Algorithms
    - Shortest Path Algorithms in Graphs
    - Minimum Spanning Tree
    - Articulation Edges and Vertexes
    - Circles and Connectivity in Graphs
    - Depth-First Search in Graphs
    - Breadth-First Search in Graphs
    - The Prufer Code and the Floyd-Warshall Algor...
    - An Insight into Graphs
    - Coding a Custom Object with WSC
    - Creating a Custom Object with WSC





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
    Stay green...Green IT