See we can modify it in different ways
IF you need login id then by the data type "select a.login_id"
<pre lang="cs">
int res =Convert.ToInt32( from a in ef.Logins where a.username == txtuser.Text && a.password == txtpass.Text select a.login_id);
Session["rcode"]=res;
if(Session["rcode"]!=null)
{
lable.text=Session["rcode"].ToString();
}</pre>
Then If you need to keep whole login class in Session
Code below
Login res = (from a in ef.Logins where a.username == txtuser.Text && a.password == txtpass.Text select a).FirstOrDefault();
Session["rcode"]=res;
if(Session["rcode"]!=null)
{
Login obj=(Login )Session["rcode"];
lable.text=obj.loginid;}