TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Dheeraj Sharma
NA
98
29.1k
check if user already logged in
Jan 3 2018 5:55 AM
i want to check if user is already logged in,
do anyone have code to check that user is already logged in,
my code is below,
public ActionResult GetLogin(Register d,Login r)
{
using (simpleEntities _LoginEntities = new simpleEntities())
{
var user = _LoginEntities.Registers.Where(u => u.Email.Equals(d.Email) && u.Password.Equals(d.Password)).FirstOrDefault();
string message = "User already logged in";
if (user != null)
{
//var user1 = _LoginEntities.Logins.Where(v => v.Status == 0);
//if (r.Status != 1 && d.ID ==r.LogID)
//if (user1!=null)
{
Session["ID"] = user.ID.ToString();
Session["Email"] = user.Email.ToString();
Session["Username"] = user.Fname.ToString() + "" + user.Lname.ToString();
return RedirectToAction("UserDashBoard");
}
//else
//{
//
//}
}
return Json(message, JsonRequestBehavior.AllowGet);
}
}
first it will check in register table that credential are correct or not then it will check in logins table that user is already logged in
if anyone have if condition to check conditions from both table then it will be helpful
Reply
Answers (
1
)
Reverse a number - Decimal to Octal
CRUD operations in ASP.NET MVC via EF Code First using SP's