On click of your Login Button validate the user with database if the user is valid just write the following:-
protected void btnLogin_Click(object Sender,EventArgs e)
{
if((TxtUserName.Text=="Raj") && (txtPassword.Text=="password"))
{
Session["UID"]=txtUserName.Text;
Response.Redirect("HomePage.aspx");
}
}
if(!String.IsNullOrEmpty(Session["UID"]))
{
lblWelcome.Text="Welcome" + Session["UID"].ToString();
lnkLogout.Visible=true;
}
else
{
Response.Redirect("LoginPage.aspx");
}
I guess i have given enough material to make you understand how u can use session for login status. If you have more doubts do not hesitate to ask i am always there.