It's better to use asp.net membership, or identity to do these things, but if you are doing this is a learning task then you can store if the user is logged in using the Session. Store their ID or username, and if you need to know if they are logged in check to see if the relevant session variables have a value.
A handy way to show\hide certain elements depending on if someone is authenticated is to use placeholders which you make visible or hidden depending.
<asp:PlaceHolder ID="placeAuthenticated" runat="server" Visible="false">
<div>Hello <%=Session["Username"] %> (<asp:HyperLink ID="linkLogout" runat="server" NavigateUrl="~/Logout.aspx">logout</asp:HyperLink>)
</div>
</asp:PlaceHolder>
<asp:PlaceHolder ID="placeAnonymous" runat="server" Visible="true">
<asp:Button ID="cmdLogin" runat="server" Text="Login" OnClick="cmdLogin_Click" />
</asp:PlaceHolder>
protected void Page_Load(object sender, EventArgs e)
{
if(!string.IsNullOrWhiteSpace((string)Session["Username"]))
{
placeAnonymous.Visible = false;
placeAuthenticated.Visible = true;
}
}
protected void cmdLogin_Click(object sender, EventArgs e)
{
Session["Username"] = "user1";
Response.Redirect("test.aspx");
}