最近ASP.NET WAP开发的一些情况!

原文地址为: 最近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>下
None.gif < browserCaps >
None.gif            
< result  type ="System.Web.Mobile.MobileCapabilities, System.Web.Mobile, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
None.gif            
< use  var ="HTTP_USER_AGENT" />
None.gif                    preferredRenderingType = "wml11"
None.gif                    preferredRenderingMime = "text/vnd.wap.wml"
None.gif                    preferredImageMime = "image/vnd.wap.wbmp"
None.gif
</ browserCaps >

如果定义相关其它属性可以完整的移动设置属性:
None.gif      < browserCaps >
None.gif            
< result  type ="System.Web.Mobile.MobileCapabilities, System.Web.Mobile, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
None.gif            
< use  var ="HTTP_USER_AGENT" />
None.gif
None.gif            browser=Unknown
None.gif            version=0.0
None.gif            majorversion=0
None.gif            minorversion=0
None.gif            frames=false
None.gif            tables=false
None.gif            cookies=false
None.gif            backgroundsounds=false
None.gif            vbscript=false
None.gif            javascript=false
None.gif            javaapplets=false
None.gif            activexcontrols=false
None.gif            win16=false
None.gif            win32=false
None.gif            beta=false
None.gif            ak=false
None.gif            sk=false
None.gif            aol=false
None.gif            crawler=false
None.gif            cdf=false
None.gif            gold=false
None.gif            authenticodeupdate=false
None.gif            tagwriter=System.Web.UI.Html32TextWriter
None.gif            ecmascriptversion=0.0
None.gif            msdomversion=0.0
None.gif            w3cdomversion=0.0
None.gif            platform=Unknown
None.gif            css1=false
None.gif            css2=false
None.gif            xml=false
None.gif
None.gif            mobileDeviceManufacturer = "Unknown"
None.gif            mobileDeviceModel = "Unknown"
None.gif
None.gif            gatewayVersion = "None"
None.gif            gatewayMajorVersion = "0"
None.gif            gatewayMinorVersion = "0"
None.gif
None.gif           preferredRenderingType = "wml11"
None.gif           preferredRenderingMime = "text/vnd.wap.wml"
None.gif           preferredImageMime = "image/vnd.wap.wbmp"
None.gif
None.gif            defaultScreenCharactersWidth = "12"
None.gif            defaultScreenCharactersHeight = "6"
None.gif            defaultScreenPixelsWidth = "96"
None.gif            defaultScreenPixelsHeight = "72"
None.gif            defaultCharacterWidth = "8"
None.gif            defaultCharacterHeight = "12"
None.gif            screenBitDepth = "1"
None.gif            isColor = "false"
None.gif            inputType = "telephoneKeypad"
None.gif
None.gif            numberOfSoftkeys = "0"
None.gif            maximumSoftkeyLabelLength = "5"
None.gif
None.gif            canInitiateVoiceCall = "false"
None.gif
None.gif            canSendMail = "true"
None.gif            hasBackButton = "true"
None.gif            rendersWmlDoAcceptsInline = "true"
None.gif            rendersWmlSelectsAsMenuCards = "true"
None.gif            rendersBreaksAfterWmlAnchor = "false"
None.gif            rendersBreaksAfterWmlInput = "false"
None.gif            rendersBreakBeforeWmlSelectAndInput = "true"
None.gif            requiresAttributeColonSubstitution = "true"
None.gif            requiresPhoneNumbersAsPlainText = "false"
None.gif            requiresUrlEncodedPostfieldValues = "false"
None.gif            requiredMetaTagNameValue = ""
None.gif            rendersBreaksAfterHtmlLists = "true"
None.gif            requiresUniqueHtmlCheckboxNames = "true"
None.gif            requiresUniqueHtmlInputNames = "true"
None.gif            requiresUniqueFilePathSuffix = "true"
None.gif            supportsCss = "false"
None.gif            hidesRightAlignedMultiselectScrollbars = "false"
None.gif            canRenderAfterInputOrSelectElement = "true"
None.gif            canRenderInputAndSelectElementsTogether = "true"
None.gif            canRenderOneventAndPrevElementsTogether = "true"
None.gif            canCombineFormsInDeck = "true"
None.gif            canRenderMixedSelects = "true"
None.gif            canRenderPostBackCards = "true"
None.gif            canRenderSetvarZeroWithMultiSelectionList = "true"
None.gif            supportsImageSubmit = "true"
None.gif            supportsSelectMultiple = "true"
None.gif            requiresHtmlAdaptiveErrorReporting = "false"
None.gif            requiresContentTypeMetaTag = "false"
None.gif            requiresDBCSCharacter = "false"
None.gif            requiresOutputOptimization = "false"
None.gif            supportsAccesskeyAttribute = "false"
None.gif            supportsInputIStyle = "false"
None.gif            supportsInputMode = "false"
None.gif            supportsIModeSymbols = "false"
None.gif            supportsJPhoneSymbols = "false"
None.gif            supportsJPhoneMultiMediaAttributes = "false"
None.gif            maximumRenderedPageSize = "2000"
None.gif            requiresSpecialViewStateEncoding = "false"
None.gif            requiresNoBreakInFormatting = "false"
None.gif            requiresLeadingPageBreak = "false"
None.gif            supportsQueryStringInFormAction = "true"
None.gif            supportsCacheControlMetaTag = "true"
None.gif            supportsUncheck = "true"
None.gif            canRenderEmptySelects = "true"
None.gif            supportsRedirectWithCookie = "true"
None.gif            supportsEmptyStringInCookieValue = "true"
None.gif            cachesAllResponsesWithExpires = "false"
None.gif            requiresNoSoftkeyLabels = "false"
None.gif            defaultSubmitButtonLimit = "1"
None.gif            
None.gif            supportsBold = "false"
None.gif            supportsItalic = "false"
None.gif            supportsFontSize = "false"
None.gif            supportsFontName = "false"
None.gif            supportsFontColor = "true"
None.gif            supportsBodyColor = "true"
None.gif            supportsDivAlign = "true"
None.gif            supportsDivNoWrap = "false"
None.gif            supportsCharacterEntityEncoding = "true"
None.gif
None.gif            isMobileDevice="false"
None.gif
</ 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.取消移动设备缓存:
None.gif   Page.Response.Expires  =   - 1 ;
None.gif   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/

   
转载请注明本文地址: 最近ASP.NET WAP开发的一些情况!

猜你喜欢

转载自blog.csdn.net/dearbaba_8520/article/details/82556065
今日推荐