I want to do something like below.
//Controller
if(Session["UserId"]!=null) // If user is logged in
{
return View(db.Orders.ToList());
}
else
{
//return a error message on the same view
}
how to to that??
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Manas MohapatraRank #182 · 13.2K reputationPosted Sep 6, 2015, 5:00 AM EDT