您所在的位置: 首页 > 开发 > .Net > vs.net >

用VS.NET中的Mobile Web Form创建移动网络应用程序(3)

  • 摘要:在这篇文章中,你将学到创建移动网络应用程序的基本步骤。在你可以创建一个Mobile Web Forms 应用程序前,你需要安装Microsoft Visual Studio .NET Beta 2和Mobile Internet Toolkit Beta 2。使用这些技术,你马上可以为蜂窝电话和Pocket PCs创建移动网络应用程序。
  • 标签:.NET  VS  Mobile Web Form  移动  网络

创建Name.aspx移动网络窗体

<%@ Page Codebehind="Name.cs" Inherits="NameApp.NamePage" Language="C#" %> <%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %> <mobile:Form runat="server"> <mobile:Label runat="server">What is your name?</mobile:Label> <mobile:Textbox runat="server" id="NameEdit"/> <mobile:Command runat="server" OnClick="GoCommand_OnClick" Text="Go!"/> </mobile:Form> <mobile:Form runat="server" id="SecondForm" OnActivate="SecondForm_OnActivate"> <mobile:Label runat="server" id="Greeting"/> </mobile:Form>

创建Name.cs 后台代码文件

using System; using System.Web.UI.MobileControls; namespace NameApp { public class NamePage : MobilePage { protected Form SecondForm; protected TextBox NameEdit; protected UI.Label Greeting; private String greetingText; protected void GoCommand_OnClick(Object sender, EventArgs e) { greetingText = "Hello, " + NameEdit.Text + "!"; ActiveForm = SecondForm; } protected void SecondForm_OnActivate(Object sender, EventArgs e) { Greeting.Text = greetingText; } } }

编译Name.cs 文件

  1. 在Name目录中创建一个文件夹命名的扩展名。
  2. 在命令行提示输入下面的代码来编译Name.cs 文件:
  3. C:\Inetpub\wwwroot\Name> csc /r:System.Web.dll /r:System.Web.Mobile.dll _ /target:library /out:bin\NameApp.dll Name.cs

在一个PC、一个Pocket PC或下面列出的任何现在的测试设备,浏览http://localhost/Name/Name.aspx并且测试应用程序。

当前测试的设备

◆Pocket PC
◆Sony CMD-z5 with Microsoft Mobile Explorer
◆Mitsubishi T250
◆Nokia 7110
◆Sprint Touchpoint
◆Samsung Touchpoint
◆Simulator for Microsoft Mobile Explorer version 2.01
◆Simulator for Phone.com UP 3.2
◆Simulator for Nokia 7110
◆Simulator for Phone.com UP 4.0
◆Personal computer with Microsoft Internet Explorer 5.5

结论

Microsoft Visual Studio 开发工具的下一代产品显著地减少了创建移动网络应用程序的复杂性。使用Visual Studio .NET ,你将可以从一个单独的ASP.NET页面,开发面向网络和事实上任何移动设备的应用程序-而不用学习各种各样的不同的标置语言。使用新的,简化了创建继承了对工业标准支持的移动网络应用程序的技术,例如Extensible Markup Language (XML) 和Wireless Application Protocol (WAP),Microsoft将使你可以创建下一代移动网络应用程序。

(责任编辑 火凤凰 sunsj@51cto.com  TEL:(010)68476636-8007)



共3页: 上一页 [1] [2] 3
【内容导航】
最优性价比组建无线网络
网络应用性能控管最佳实践
网络工程师职业规划与现状
计算机网络维护入门
未来五年可能必备的10大网络技术
 
 验证码: (点击刷新验证码)   匿名发表
  • C#图解教程

  • 作者:苏林,朱晔
  • 本书是一本广受赞誉的C#教程。它以图文并茂的形式,用朴实简洁的文字,并辅之以大量表格和代码示例,精炼而全面地阐述了最新版C..
Copyright©2005-2008 51CTO.COM 版权所有