웹에서 ASP.NET (비하인드코드는 VB 사용) 이용해서, 클라이언트의 브라우져 정보를 취득하는 방법 입니다.  

버튼을 누르면, 디폴트 페이지의 텍스트박스에 브라우져 관련 정보를 출력해줍니다.

 

 

 

<사용 컨트롤>

텍스트박스 1개

버튼 1개

 

Partial Public Class _Default
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    ''' <summary>
    ''' 返却された情報を利用して編集可能とするためのテストボタン
    ''' </summary>
    ''' <param name="sender">Sender</param>
    ''' <param name="e">イベントArgs</param>
    ''' <remarks></remarks>
    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
        Dim s As String = ""
        With Request.Browser
            s &= "Browser Capabilities" & vbCrLf
            s &= "Type = " & .Type & vbCrLf
            s &= "Name = " & .Browser & vbCrLf
            s &= "Version = " & .Version & vbCrLf
            s &= "Major Version = " & .MajorVersion & vbCrLf
            s &= "Minor Version = " & .MinorVersion & vbCrLf
            s &= "Platform = " & .Platform & vbCrLf
            s &= "Is Beta = " & .Beta & vbCrLf
            s &= "Is Crawler = " & .Crawler & vbCrLf
            s &= "Is AOL = " & .AOL & vbCrLf
            s &= "Is Win16 = " & .Win16 & vbCrLf
            s &= "Is Win32 = " & .Win32 & vbCrLf
            s &= "Supports Frames = " & .Frames & vbCrLf
            s &= "Supports Tables = " & .Tables & vbCrLf
            s &= "Supports Cookies = " & .Cookies & vbCrLf
            s &= "Supports VBScript = " & .VBScript & vbCrLf
            s &= "Supports JavaScript = " & _
                .EcmaScriptVersion.ToString() & vbCrLf
            s &= "Supports Java Applets = " & .JavaApplets & vbCrLf
            s &= "Supports ActiveX Controls = " & .ActiveXControls & _
                vbCrLf
        End With
        TextBox1.Text = s

    End Sub
End Class

 

 

+ Recent posts