2
Reply

ASP.NET MVC QUERY

Rinki

Rinki

6 years ago
212
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)