The followingCodeDetects the client display resolution, browser type, and Client IP address. You can save the client information to session and viewstate for direct use on other pages.
Example
Clientpeek. aspx
<xmp> &lt;Meta http-equiv = &quot;Content-Type&quot; content = &quot;text/html; charset = gb2312 &quot;&gt; &lt;meta content =&quot; Microsoft Visual Studio 7.0 &quot;name =&quot; generator &quot;&gt; &lt;meta content =&quot; C # &quot;name =&quot; code_language &quot;&gt; &lt;meta content =&quot; chapter E of Mencius ]: http://xml.sz.luohuedu.net/&quot;name =&quot; Copyright &quot;&gt; &lt;meta content =&quot; JavaScript &quot;name =&quot; vs_defaultclientscript &quot;&gt; &lt;meta content =&quot; http://schemas.microsoft.com/intellisense/ie5 &quot;name =&quot; vs_targetschema &quot;&gt; </xmp>
Clientpeek. aspx. VB
Imports system <br/> public class clientpeek <br/> inherits system. web. UI. page <br/> protected withevents label1 as system. web. UI. webcontrols. label <br/> protected withevents mybody as system. web. UI. htmlcontrols. htmlgenericcontrol <br/> # region "code generated by web forms designer" <br/> 'This call is required by the web forms designer. <Br/> <system. diagnostics. debuggerstepthrough> private sub initializecomponent () <br/> end sub <br/> 'Note: The following placeholder declaration is required by the web form designer. <Br/> 'do not delete or move it. <Br/> private designerplaceholderdeclaration as system. object <br/> private sub page_init (byval sender as system. object, byval e as system. eventargs) _ <br/> handles mybase. init <br/> 'codegen: This method is required by the web form designer. <br/> 'do not use the code editor to modify it. <Br/> initializecomponent () <br/> end sub <br/> # End Region <br/> private sub page_load (byval sender as system. object, byval e as system. eventargs) _ <br/> handles mybase. load <br/> dim button1 as new system. web. UI. webcontrols. button <br/> if not me. ispostback then <br/> dim btnw as new system. web. UI. htmlcontrols. htmlinputhidden <br/> dim btnh as new system. web. UI. htmlcontrols. htmlinputhidden <br/> button1.id = "button1" <br/> btnw. name = "widthpixel" <br/> btnw. id = "widthpixel" <br/> btnh. name = "heightpixel" <br/> btnh. id = "heightpixel" <br/> me. findcontrol ("browserpeek "). controls. add (btnw) <br/> me. findcontrol ("browserpeek "). controls. add (btnh) <br/> me. findcontrol ("browserpeek "). controls. add (button1) <br/> dim scriptstring as string = "" <br/> scriptstring + = "document. browserpeek. widthpixel. value = Window. screen. width; "<br/> scriptstring + =" document. browserpeek. heightpixel. value = Window. screen. height; "<br/> me. registeronsubmitstatement ("Meng", scriptstring) <br/> me. mybody. attributes. add ("onLoad", "document. browserpeek. button1.click (); ") <br/> else <br/> me. mybody. attributes. remove ("onLoad") <br/> if me. findcontrol ("browserpeek "). controls. contains (button1) Then <br/> me. findcontrol ("browserpeek "). controls. remove (button1) <br/> button1.dispose () <br/> end if <br/> dim strlabel as new system. text. stringbuilder <br/> dim BC as httpbrowsercapabilities = request. browser <br/> strlabel. append ("the resolution of your browser is:") <br/> strlabel. append (request. form ("widthpixel") <br/> strlabel. append ("×") <br/> strlabel. append (request. form ("heightpixel") <br/> strlabel. append ("<br/> <HR color =" #000099 ">") <br/> strlabel. append ("basic browser information: <br/>") <br/> strlabel. append ("type =" & amp; BC. type & amp; "<br/>") <br/> strlabel. append ("name =" & amp; BC. browser & amp; "<br/>") <br/> strlabel. append ("version =" & amp; BC. version & amp; "<br/>") <br/> strlabel. append ("major version =" & amp; BC. majorversion & amp; "<br/>") <br/> strlabel. append ("minor version =" & amp; BC. minorversion & amp; "<br/>") <br/> strlabel. append ("platform =" & amp; BC. platform & amp; "<br/>") <br/> strlabel. append ("is Beta =" & amp; BC. beta & amp; "<br/>") <br/> strlabel. append ("is crawler =" & amp; BC. crawler & amp; "<br/>") <br/> strlabel. append ("is AOL =" & amp; BC. AOL & amp; "<br/>") <br/> strlabel. append ("is Win16 =" & amp; BC. win16 & amp; "<br/>") <br/> strlabel. append ("is Win32 =" & amp; BC. win32 & amp; "<br/>") <br/> strlabel. append ("frames =" & amp; BC supported. frames & amp; "<br/>") <br/> strlabel. append ("tables =" & amp; BC supported. tables & amp; "<br/>") <br/> strlabel. append ("supports cookies =" & amp; BC. cookies & amp; "<br/>") <br/> strlabel. append ("supports VB Script =" & amp; BC. VBScript & amp; "<br/>") <br/> strlabel. append ("supports JavaScript =" & amp; BC. javascript & amp; "<br/>") <br/> strlabel. append ("supports Java applets =" & amp; BC. javaapplets & amp; "<br/>") <br/> strlabel. append ("ActiveX controls =" & amp; BC supported. activexcontrols & amp; "<br/>") <br/> strlabel. append ("CDF =" & amp; BC. CDF & amp; "<br/>") <br/> strlabel. append ("w3cdomversion =" + BC. w3cdomversion. tostring + "<br/>") <br/> strlabel. append ("useragent =" + request. useragent + "<br/>") <br/> strlabel. append ("userages =" + request. userages (0 ). tostring + "<br/>") <br/> strlabel. append ("<br/> <HR color =" #000099 ">") <br/> strlabel. append ("basic Client Computer Configuration: <br/>") <br/> strlabel. append ("userhostname =" + request. userhostname + "<br/>") <br/> strlabel. append ("userhostaddress =" + request. userhostaddress + "<br/>") <br/> label1.text = strlabel. tostring () <br/> end if <br/> end sub <br/> end class <br/> </system. diagnostics. debuggerstepthrough>
C # code
Clientpeek. aspx
<xmp> &lt;Meta http-equiv = &quot;Content-Type&quot; content = &quot;text/html; charset = gb2312 &quot;&gt; &lt;meta content =&quot; Microsoft Visual Studio 7.0 &quot;name =&quot; generator &quot;&gt; &lt;meta content =&quot; C # &quot;name =&quot; code_language &quot;&gt; &lt;meta content =&quot; chapter E of Mencius ]: http://xml.sz.luohuedu.net/&quot;name =&quot; Copyright &quot;&gt; &lt;meta content =&quot; JavaScript &quot;name =&quot; vs_defaultclientscript &quot;&gt; &lt;meta content =&quot; http://schemas.microsoft.com/intellisense/ie5 &quot;name =&quot; vs_targetschema &quot;&gt; </xmp>
Clientpeek. aspx. CS
Using system; <br/> using system. collections; <br/> using system. componentmodel; <br/> using system. data; <br/> using system. drawing; <br/> using system. web; <br/> using system. web. sessionstate; <br/> using system. web. ui; <br/> using system. web. UI. webcontrols; <br/> using system. web. UI. htmlcontrols; <br/> namespace emeng. exam <br/>{< br/> /// <br/> <summary> /// Summary of checkpeek. <Br/> // </Summary> <p> public class clientpeek: system. web. UI. page <br/> {<br/> protected system. web. UI. webcontrols. label label1; <br/> protected system. web. UI. htmlcontrols. htmlgenericcontrol mybody; <br/> private void page_load (Object sender, system. eventargs e) <br/>{< br/> // place the user code here to initialize the page <br/> system. web. UI. webcontrols. button button1 = new system. web. UI. webcontrols. button (); <br/> If (! Ispostback) <br/>{< br/> system. web. UI. htmlcontrols. htmlinputhidden btnw = new system. web. UI. htmlcontrols. htmlinputhidden (); <br/> system. web. UI. htmlcontrols. htmlinputhidden btnh = new system. web. UI. htmlcontrols. htmlinputhidden (); <br/> system. web. UI. htmlcontrols. htmlinputhidden btnpdf = new system. web. UI. htmlcontrols. htmlinputhidden (); <br/> button1.id = "button1"; <br/> btnw. name = "widthpixel"; <br/> Btnw. id = "widthpixel"; <br/> btnh. name = "heightpixel"; <br/> btnh. id = "heightpixel"; <br/> btnpdf. name = "pdf"; <br/> btnpdf. id = "pdf"; <br/> This. findcontrol ("browserpeek "). controls. add (btnw); <br/> This. findcontrol ("browserpeek "). controls. add (btnh); <br/> This. findcontrol ("browserpeek "). controls. add (btnpdf); <br/> This. findcontrol ("browserpeek "). controls. add (button1); <br/> string scriptstring = ""; <Br/> scriptstring + = "document. all. browserpeek. widthpixel. value = Window. screen. width; \ r \ n "; <br/> scriptstring + =" document. all. browserpeek. heightpixel. value = Window. screen. height; \ r \ n "; <br/> scriptstring + =" document. all. browserpeek. PDF. value = optional plugin; \ r \ n "; <br/> This. registeronsubmitstatement ("Meng", scriptstring); <br/> This. mybody. attributes. add ("onLoad", "document. all. "+ button1.clientid + ". click (); "); <Br/>}< br/> else <br/>{< br/> This. mybody. attributes. remove ("onLoad"); <br/> If (this. findcontrol ("browserpeek "). controls. contains (button1) <br/>{< br/> This. findcontrol ("browserpeek "). controls. remove (button1); <br/> button1.dispose (); <br/>}< br/> system. text. stringbuilder strlabel = new system. text. stringbuilder (); <br/> httpbrowsercapabilities BC = request. browser; <br/> strlabel. append ("your browser score Resolution: "); <br/> strlabel. append (request. form ["widthpixel"]); <br/> strlabel. append ("×"); <br/> strlabel. append (request. form ["heightpixel"]); <br/> strlabel. append ("<br/> <HR color =" #000099 ">"); <br/> strlabel. append ("basic browser information: <br/>"); <br/> strlabel. append ("type =" + BC. type + "<br/>"); <br/> strlabel. append ("name =" + BC. browser + "<br/>"); <br/> strlabel. append ("version =" + BC. version + "<br/>"); <br /> Strlabel. append ("major version =" + BC. majorversion + "<br/>"); <br/> strlabel. append ("minor version =" + BC. minorversion + "<br/>"); <br/> strlabel. append ("platform =" + BC. platform + "<br/>"); <br/> strlabel. append ("is Beta =" + BC. beta + "<br/>"); <br/> strlabel. append ("is crawler =" + BC. crawler + "<br/>"); <br/> strlabel. append ("is AOL =" + BC. AOL + "<br/>"); <br/> strlabel. append ("I S Win16 = "+ BC. win16 + "<br/>"); <br/> strlabel. append ("is Win32 =" + BC. win32 + "<br/>"); <br/> strlabel. append ("frames =" + bc supported. frames + "<br/>"); <br/> strlabel. append ("tables =" + bc supported. tables + "<br/>"); <br/> strlabel. append ("supports cookies =" + BC. cookies + "<br/>"); <br/> strlabel. append ("supports VB Script =" + BC. VBScript + "<br/>"); <br/> strlabel. append ("supports JavaScript =" + BC. javascrip T + "<br/>"); <br/> strlabel. append ("supports Java applets =" + BC. javaapplets + "<br/>"); <br/> strlabel. append ("ActiveX controls =" + bc supported. activexcontrols + "<br/>"); <br/> strlabel. append ("CDF =" + BC. CDF + "<br/>"); <br/> strlabel. append ("w3cdomversion =" + BC. w3cdomversion. tostring () + "<br/>"); <br/> strlabel. append ("useragent =" + request. useragent + "<br/>"); <br/> strlabel. append ("userlan Guages = "+ request. userages [0]. tostring () + "<br/>"); <br/> strlabel. append ("<br/> <HR color =" #000099 ">"); <br/> strlabel. append ("basic Client Computer Configuration: <br/>"); <br/> strlabel. append ("userhostname =" + request. userhostname + "<br/>"); <br/> strlabel. append ("userhostaddress =" + request. userhostaddress + "<br/>"); <br/> strlabel. append ("whether to install the PDF 6.0 plug-in =" + request. form ["pdf"] + "<br/>"); <br/> label1. TEXT = strlabel. tostring (); <br/>}< br/> # code generated by region web forms designer <br/> override protected void oninit (eventargs E) <br/>{< br/> // <br/> // codegen: Asp.. NET web form designer. <Br/> // <br/> initializecomponent (); <br/> base. oninit (E ); <br/>}< br/> /// <br/> <summary> // The method required by the designer. Do not use the code editor to modify the method. <br/> // /content of this method. <Br/> // </Summary> <p> private void initializecomponent () <br/>{< br/> This. load + = new system. eventhandler (this. page_load); <br/>}< br/> # endregion <br/>}< br/>}