1 Public voidProcessRequest (HttpContext context)2 {3Context. Response.ContentType ="text/html";4HttpBrowserCapabilities BC =context. Request.Browser;5 //context. Response.Write ("<p>browser capabilities:</p>");6 //context. Response.Write ("Type =" + BC.) Type + "<br>");7 //context. Response.Write ("Name =" + BC.) Browser + "<br>");8 //context. Response.Write ("Version =" + BC.) Version + "<br>");9 //context. Response.Write ("Major Version =" + BC.) MajorVersion + "<br>");Ten //context. Response.Write ("Minor Version =" + BC.) MinorVersion + "<br>"); One //context. Response.Write ("Platform =" + BC.) Platform + "<br>"); A //context. Response.Write ("is Beta =" + BC.) Beta + "<br>"); - //context. Response.Write ("is Crawler =" + BC. Crawler + "<br>"); - //context. Response.Write ("is AOL =" + BC.) AOL + "<br>"); the //context. Response.Write ("is Win16 =" + BC. Win16 + "<br>"); - //context. Response.Write ("is Win32 =" + BC. Win32 + "<br>"); - //context. Response.Write ("Supports Frames =" + BC. Frames + "<br>"); - //context. Response.Write ("Supports Tables =" + BC. Tables + "<br>"); + //context. Response.Write ("Supports Cookies =" + BC.) Cookies + "<br>"); - //context. Response.Write ("Supports VB Script =" + BC.) VBScript + "<br>"); + //context. Response.Write ("Supports JavaScript =" + BC.) JavaScript + "<br>"); A //context. Response.Write ("Supports Java Applets =" + BC. Javaapplets + "<br>"); at //context. Response.Write ("Supports ActiveX Controls =" + BC.) ActiveXControls + "<br>"); - //context. Response.Write ("CDF =" + BC.) CDF + "<br>"); - //context. Response.Write (BC. supportsxmlhttp); - //context. Response.Write (HttpContext.Current.Request.UserAgent + "<br>"); - stringSS =HttpContext.Current.Request.UserAgent; -Context. Response.Write (ss+"<br>"); in stringm ="Mobile"; - intres= SS. ToLower (). IndexOf (M,0, SS. Length); to if(res<=0) + { -Context. Response.Write ("PC-Side"); the } * Else $ {Panax NotoginsengContext. Response.Write ("you're using a mobile phone."); - } the + A}
The message that is submitted by the client is obtained by useragent and stored as a string;
By matching the string, if the string contains mobile, then return to the phone side, otherwise the PC-side
The server determines whether the client is a mobile or PC-side