The Linq query is ultimately converted to an SQL query, and LINQ does not know what to do with Session["UserName"] (which receives the "UserName" element).
A common way around this is to simply use the local variable that you assigned Session["UserName"] , and which you will use in your Linq query ...
as
string loggedUserName = Session["LogedUsername"].ToString(); var userdetail = dc.faculties.Where(a => a.F_UserName.Equals(loggedUserName)).FirstOrDefault();
link http://mvc4asp.blogspot.in/
user3265146 Sep 08 '14 at 15:16 2014-09-08 15:16
source share