
Partial Class system_Default2
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then

            'スマホ or PC
            If Request.Browser.IsMobileDevice Then
                vPage.Style.Add("width", "530px")
                PanelPC.Visible = False
                PanelMobile.Visible = True
            Else
                vPage.Style.Add("width", "1220px")
                PanelPC.Visible = True
                PanelMobile.Visible = False
            End If

            If Not IsPostBack Then
                'ユーザー認証
                Dim xIP As String = Request.ServerVariables("REMOTE_ADDR")
                LabelIP.Text = xIP
                Dim xCookie As String = ""
                If Request.Cookies("Local") IsNot Nothing Then
                    xCookie = Request.Cookies("Local").Value
                    Session("cookie") = xCookie
                    Dim dt As Data.DataView = SqlDataSourceSystemByCookie.Select(DataSourceSelectArguments.Empty)
                    If dt IsNot Nothing AndAlso dt.Count <> 0 Then

                    Else
                        Response.Redirect("../NotAllowed.aspx?msg=システム管理者として認証されていません")
                        Response.End()
                    End If
                Else
                    Response.Redirect("../NotAllowed.aspx?msg=会員として認証されていません")
                    Response.End()
                End If
            End If

            Dim ds As Data.DataView = SqlDataSourceMember.Select(DataSourceSelectArguments.Empty)
            LabelCount.Text = ds.Count.ToString
            'Session("cookie") = "801,成田　隆人,2009/2/1"


        End If
    End Sub

    Protected Sub Button4_Click(sender As Object, e As System.EventArgs) Handles Button4.Click
        If IsPostBack Then
            If String.IsNullOrEmpty(TextBoxName.Text) Then LabelMsg.Text = "名前が有りません" : Exit Sub
            Session("name") = TextBoxName.Text
            ListViewKaiin.DataSourceID = "SqlDataSourceKaiinByName"
            ListViewKaiin.DataBind()
        End If
    End Sub
End Class
