[转] ASP.NET 开发 WAP 网站

使用ASP.NET开发WAP很简单,只需要新建一个空的网站,向其中添加移动WEB窗体即可.可以使用OPERA浏览器与M3GATE来调试网页,

强制输出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 >

 

乱码问题,可以在WEB.CONFIG中设置:

 

< globalization    requestEncoding ="UTF-8"        responseEncoding ="UTF-8"   />

 

在OPERA或M3GATE中设置编码为UTF-3即可显示中文.

使用MS自带的移动控件可以很方便的建立网站,如LINK,COMMAND,LABEL等

 

使用ASP.NET开发移动通讯的几种方法 
http://www.yesky.com/35/1640535.shtml 

用VS2005实现ASP.NET2.0移动开发 
http://dev.yesky.com/msdn/293/2371793.shtml 

ASP.NET 2.0移动开发入门之基础 
http://dev.yesky.com/msdn/373/2411873.shtml 

ASP.NET 2.0移动开发入门之使用模拟器 
http://dev.yesky.com/msdn/465/2471465.shtml 

ASP.NET 2.0移动开发入门之使用样式 
http://dev.yesky.com/msdn/230/2486230.shtml 

ASP.NET 2.0移动开发之属性重写和模板化 
http://dev.yesky.com/msdn/90/2570590.shtml 

ASP.NET 2.0移动开发之定义设备筛选器 
http://dev.yesky.com/msdn/117/2579117.shtml
参考资料:http://dev.yesky.com

你可能感兴趣的:(asp.net)