I need to send ID of the user to _layout.cshtml but i couldnt make it through viewbag or model. How to do it? Do I need to send it Specifcally to the _layout or How ?? Here is my Action Method:

public ActionResult validate()
        {
            List<user> list = cx.users.ToList<user>();
            user u = new user();
            u.username = Request.Form["username"];
            u.password = Request.Form["password"];
            for (int i = 0; i < list.Count; i++)
            {
                if (list[i].username == u.username && list[i].password == u.password)
                {
                    ViewBag.x = list[i].Id;
                    return RedirectToAction("index", "Home",  list[i]);
                }
            }
            return RedirectToAction("login");
        }

Related posts

Recent Viewed