Rinki

Rinki

  • 529
  • 2.4k
  • 32.6k

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)