login
Imports System.IO
Partial Class Login
Inherits System.Web.UI.UserControl
Protected Sub btnLogin_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Handles btnLogin.Click
Dim sr As System.IO.StreamReader
Dim txt As String
sr = System.IO.File.OpenText("C:\Login.txt")
txt = sr.ReadLine()
sr.Close()
If txt = (txtUser.Text & txtPwd.Text) Then
Session("User") = txtUser.Text
Else
' errore
End If
End Sub
Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.PreRender
If Session("User") Is Nothing Then
pnlWelcome.Visible = False
pnlLogin.Visible = True
Else
pnlWelcome.Visible = True
pnlLogin.Visible = False
lblutente.Text = Session("User").ToString
End If
End Sub
End Class