Vs2008 开发Wap

1、下载Wap模版插件,解压后复制到 [My Document]\Visual Studio 2008\Templates\ItemTemplates\下(看readme)

2、下载最新的Opera 浏览器(可以支持Wap浏览)

3、新建立一个项目Web网站

Vs2008 开发Wap

4、把建立网站的默认Web.config删除 

5、创建Wap一个新的的Web.config

Vs2008 开发Wap

Web.config 增加以下代码:

<system.web>

<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="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>

</system.web>

6、在建立一个新的aspx 文件

Vs2008 开发Wap

7、index.aspx 加入内容:
   
     
< mobile:Form id = " Form1 " runat = " server " Title = " 测试 " >
< mobile:Link ID = " Link1 " Runat = " server " BreakAfter = " False " NavigateUrl = " 1.aspx " > 注册会员 </ mobile:Link >
< mobile:Label ID = " Label2 " Runat = " server " BreakAfter = " False " >||</ mobile:Label >
< mobile:Link ID = " Link4 " Runat = " server " BreakAfter = " False " NavigateUrl = " 2.aspx " > 登陆 </ mobile:Link >
< mobile:Label ID = " Label3 " Runat = " server " BreakAfter = " False " >||</ mobile:Label >
< mobile:Link ID = " Link2 " Runat = " server " BreakAfter = " False " NavigateUrl = " 3.aspx " > 退出 </ mobile:Link >
< mobile:Label ID = " Label4 " Runat = " server " BreakAfter = " False " >||</ mobile:Label >
< mobile:Link ID = " Link3 " Runat = " server " BreakAfter = " True " NavigateUrl = " 4.aspx " > 呵呵 </ mobile:Link >


< mobile:Label ID = " Label25 " Runat = " server " ForeColor = " Red " Wrapping = " Wrap " > 本站资源所有免费 !</ mobile:Label >

< mobile:Label ID = " Label16 " Runat = " server " Wrapping = " Wrap " > 版权所有:炽(MyChy)个人主页 </ mobile:Label >
< mobile:Label ID = " Label15 " Runat = " server " > www.jeanwen.com </ mobile:Label >

</ mobile:Form >

8、可以了基本一个设定完成! 现在需要最重要的设定 强制输出 wml格式 

web.config 加入:

 

   
     
< system.web >
< browserCaps >
< result type = " System.Web.Mobile.MobileCapabilities, System.Web.Mobile, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a " />
< use var = " HTTP_USER_AGENT " />
preferredRenderingType
= " wml11 "
preferredRenderingMime
= " text/vnd.wap.wml "
preferredImageMime
= " image/vnd.wap.wbmp "
</ browserCaps >
</ system.web >

9、点击网站生成 用 Opera  浏览

你可能感兴趣的:(vs2008)