In Focus

Forums - C# Corner

Forum guidelines
Yogesh Vedpathak

Yogesh Vedpathak

  • 1.3k
  • 221
  • 4.5k

Not Getting Data Nullable Exception

Jan 12 2018 5:20 AM
public ActionResult Logout(UserProfile objUser)
{
{
if (ModelState.IsValid)
{
using (SessionEntities Db = new SessionEntities())
{
var obj = Db.UserProfiles.Where(a => a.UserName.Equals(objUser.UserName) && a.Password.Equals(objUser.Password)).FirstOrDefault();
if (obj != null)
{
Session["UserName"] = objUser.UserName.ToString();
// Session["UserName"] = obj.UserName.ToString();
// Session.Remove(a.ToString());
Session.Abandon();
return RedirectToAction("Login");
}
else
{
return RedirectToAction("Admin");
}
}
}
}
return RedirectToAction("UserDashBoard");
}

Answers (5)

X

Build smarter apps with Machine Learning, Bots, Cognitive Services - Start free.

Start Learning Now