zoukankan      html  css  js  c++  java
  • ASP.NET WAP开发

    最近要做一个与联通的WAP接口
    我选择用ASP.NET开发,ASP.NET开发WAP站点,实在简单,就是一个移动控件的运用,根本不用懂WML语法.唯一不同的,就是一个ASPX文件可以支持多个FORM,不同FORM之间可以切换,
    最后ASP.NET根据访问的设备,输出不同的内容,
    如果用IE访问就输出HTML,手机访问,输出WML,
    不过在开发过程中也遇到了很多问题,一些问题总结如下:
    1.模拟器选择:
    WINWAP,
    M3Gate,
    UP.SDK4.0,(推荐)
    OPenWave 5.0 (测试时需要),
    OPenWave6.2, (IIS 6.0应用,IIS5.0可能显示,但会有问题)
    CheckCom WAPBrowser 3.2
    模拟器问题:
    ASP.NET把一些常有的模拟器,的配制信息用正则表达式写在Machine.config里
    在上述的模拟器中,我只有UP.SDK4.0,OPenWave 5.0,
    他们只是一个公司的产品:
    需要下载,配制文件驱动更新:现在最新版本是:Device 4下载请到这里下载:
    http://www.microsoft.com/downloads/details.aspx?FamilyId=02FA15FE-40D9-4DCE-9BB1-4DD61A5B7CCB&displaylang=en
    但是,即使驱动更新以后,还是一些设备不能访问:
    这时需要强制输出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>

    如果定义相关其它属性可以完整的移动设置属性:
    <browserCaps>
    <result type="System.Web.Mobile.MobileCapabilities, System.Web.Mobile, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
    <use var="HTTP_USER_AGENT"/>

    browser=Unknown
    version=0.0
    majorversion=0
    minorversion=0
    frames=false
    tables=false
    cookies=false
    backgroundsounds=false
    vbscript=false
    javascript=false
    javaapplets=false
    activexcontrols=false
    win16=false
    win32=false
    beta=false
    ak=false
    sk=false
    aol=false
    crawler=false
    cdf=false
    gold=false
    authenticodeupdate=false
    tagwriter=System.Web.UI.Html32TextWriter
    ecmascriptversion=0.0
    msdomversion=0.0
    w3cdomversion=0.0
    platform=Unknown
    css1=false
    css2=false
    xml=false

    mobileDeviceManufacturer = "Unknown"
    mobileDeviceModel = "Unknown"

    gatewayVersion = "None"
    gatewayMajorVersion = "0"
    gatewayMinorVersion = "0"

    preferredRenderingType = "wml11"
    preferredRenderingMime = "text/vnd.wap.wml"
    preferredImageMime = "image/vnd.wap.wbmp"

    defaultScreenCharactersWidth = "12"
    defaultScreenCharactersHeight = "6"
    defaultScreenPixelsWidth = "96"
    defaultScreenPixelsHeight = "72"
    defaultCharacterWidth = "8"
    defaultCharacterHeight = "12"
    screenBitDepth = "1"
    isColor = "false"
    inputType = "telephoneKeypad"

    numberOfSoftkeys = "0"
    maximumSoftkeyLabelLength = "5"

    canInitiateVoiceCall = "false"

    canSendMail = "true"
    hasBackButton = "true"
    rendersWmlDoAcceptsInline = "true"
    rendersWmlSelectsAsMenuCards = "true"
    rendersBreaksAfterWmlAnchor = "false"
    rendersBreaksAfterWmlInput = "false"
    rendersBreakBeforeWmlSelectAndInput = "true"
    requiresAttributeColonSubstitution = "true"
    requiresPhoneNumbersAsPlainText = "false"
    requiresUrlEncodedPostfieldValues = "false"
    requiredMetaTagNameValue = ""
    rendersBreaksAfterHtmlLists = "true"
    requiresUniqueHtmlCheckboxNames = "true"
    requiresUniqueHtmlInputNames = "true"
    requiresUniqueFilePathSuffix = "true"
    supportsCss = "false"
    hidesRightAlignedMultiselectScrollbars = "false"
    canRenderAfterInputOrSelectElement = "true"
    canRenderInputAndSelectElementsTogether = "true"
    canRenderOneventAndPrevElementsTogether = "true"
    canCombineFormsInDeck = "true"
    canRenderMixedSelects = "true"
    canRenderPostBackCards = "true"
    canRenderSetvarZeroWithMultiSelectionList = "true"
    supportsImageSubmit = "true"
    supportsSelectMultiple = "true"
    requiresHtmlAdaptiveErrorReporting = "false"
    requiresContentTypeMetaTag = "false"
    requiresDBCSCharacter = "false"
    requiresOutputOptimization = "false"
    supportsAccesskeyAttribute = "false"
    supportsInputIStyle = "false"
    supportsInputMode = "false"
    supportsIModeSymbols = "false"
    supportsJPhoneSymbols = "false"
    supportsJPhoneMultiMediaAttributes = "false"
    maximumRenderedPageSize = "2000"
    requiresSpecialViewStateEncoding = "false"
    requiresNoBreakInFormatting = "false"
    requiresLeadingPageBreak = "false"
    supportsQueryStringInFormAction = "true"
    supportsCacheControlMetaTag = "true"
    supportsUncheck = "true"
    canRenderEmptySelects = "true"
    supportsRedirectWithCookie = "true"
    supportsEmptyStringInCookieValue = "true"
    cachesAllResponsesWithExpires = "false"
    requiresNoSoftkeyLabels = "false"
    defaultSubmitButtonLimit = "1"

    supportsBold = "false"
    supportsItalic = "false"
    supportsFontSize = "false"
    supportsFontName = "false"
    supportsFontColor = "true"
    supportsBodyColor = "true"
    supportsDivAlign = "true"
    supportsDivNoWrap = "false"
    supportsCharacterEntityEncoding = "true"

    isMobileDevice="false"
    </browserCaps>

    具体属性的意思可以考试MSDN:设备功能列表
    ms-help://MS.MSDNQTR.2003FEB.2052/mwsdk/html/mwlrfDeviceCapabilitiesTable.htm

    2.链接:
    在同一个aspx文件,使用Link控件的,#FORM来切换不同Form时在 OPenWave 5.0测试会出现错误!
    建议在程序通过ActiveForm来做
    3.乱码:
    如果在开发过程出现乱码,通过修改Web.Config
    <globalization
    requestEncoding="gb2312"
    responseEncoding="gb2312"
    />
    4.取消移动设备缓存:
    Page.Response.Expires = -1;
    Response.CacheControl = "Public";

    5.重定向
    重定向通过
    RedirectToMobilePage函数
    不过使用过程中可能会出现一些问题
    建议用Link控件来代替

    一些开发资料:
    http://msdn.microsoft.com/mobility/downloads/sdks/default.aspx

    http://www.dotnet247.com/247reference/__site/72

    http://www.wapease.com

    http://www.sp-forum.org/download/list.asp?type=14

    http://www2.chn.monternet.com:8080/devdownload/DevWapSimulator.jsp

    http://www.tech-archive.net/Archive/DotNet/microsoft.public.dotnet.framework.aspnet.mobile/
  • 相关阅读:
    User Profile Service 应用程序的新增功能
    内容管理互操作性服务 (CMIS) 连接器概述 (SharePoint Server 2010)
    AD二次开发提示“出现了一个操作错误”的解决办法
    Excel2010与MOSS2010数据同步配置
    InfoPath2010表单IE浏览器2个“微型内嵌工具”的使用和介绍
    洗礼灵魂,修炼python(1)python简介
    洗礼灵魂,修炼python(2)python安装和配置
    C语言标准定义的32个关键字
    【学习笔记】.NET知识体系结构
    【读】自定义博客园皮肤:暗色流体响应式布局
  • 原文地址:https://www.cnblogs.com/wmz/p/1673426.html
Copyright © 2011-2022 走看看