Rinki

Rinki

  • 531
  • 2.4k
  • 32.4k

ASP.NET MVC QUERY

Oct 2 2017 12:49 AM
hello friends.
i want to fetch record by using "session". 
 i want to get record of particular logged user.
 i am using this. bit it not working.
 
==========================
 
public class UserController : Controller 
{ 
private Entities db = new Entities(); 
public ActionResult Index() 
{ 
int userId = (int)Session["LoggedUserID"]; 
var user = db.Users.SingleOrDefault(u=>u.UserId==userId); 
if (user != null) return View(user); // this return View(); 
} 
}
please help me.



 
 
 

Answers (2)