Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i am trying to retrieve data(name) from database using emailid and password but it does't showing anything on screen

What I have tried:

C#
public ActionResult Signin([Bind(Include = "id,emailid,password")] datatable datatable)
        {   TempData["username"] = db.datatables.Where(x => x.emailid == datatable.emailid && x.password == datatable.password).Select(x =>x.name).FirstOrDefault();
                return RedirectToAction("Details");
            }
    public ActionResult Details()
        {  ViewBag.name = TempData["username"];}
Posted
Updated 2-May-18 3:43am
v3
Comments
MadMyche 2-May-18 11:41am    
Perhaps the password has been SECURED (as recommended) and your routine is not accounting for it
Stryder_1 2-May-18 12:11pm    
When you debug, does TempData["username"] contain a value before the RedirectToAction call?

If so, when the Details function is executed, does the TempData["username"] still have a value?
Member 13674211 3-May-18 11:23am    
yes,i have tried like this TempData["username"] = db.datatables.Where(x => x.id == 1).Select(x =>x.name).FirstOrDefault();
Now this time it is showing name

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900