If you would want to just store the login name in the session then do the below
Session("username") = Login1.UserName
if you would want to check the login name against a database
Drag a drop a Login control onto the page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Login1.Focus()
End Sub
Protected Sub Login1_LoggedIn(sender As Object, e As System.EventArgs) Handles Login1.LoggedIn
validateuser()
End Sub
Sub validateuser()
Try
sqlcon = New OleDbConnection(constr)
sqlcon.Open()
sqlcmd = New OleDbCommand("SELECT COUNT(*) FROM userrole WHERE username = '" + Login1.UserName + "'" AND username =
retval = sqlcmd.ExecuteScalar
If retval = 1 Then
sqlcmd = New OleDbCommand("SELECT role, emailid FROM userrole WHERE username = '" + Login1.UserName + "'", sqlcon)
sqlrdr = sqlcmd.ExecuteReader()
sqlrdr.Read()
Session("username") = Login1.UserName
getrole = (sqlrdr.Item("role"))
Session("userrole") = getrole
getemail = (sqlrdr.Item("emailid"))
Session("reqemailid") = getemail
Response.Redirect("~\Home.aspx")
Else
End If
Catch ex As Exception
lbl_msg.Text = ex.Message.ToString
End Try
End Sub