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
28.9k
prevent multiple login using mvc-4
Jan 4 2018 4:54 AM
i have two table name Register and Login,
when user logs in the, user id and its status=1 will be store in Logins table and when user logs out status will become 0.
my problem is how should i check at login time that user is already logged in or not,
any if conditions to check, below is my code
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)
{
List
ddd = new List
();
ddd = (from a in db.Logins where a.LogID == user.ID where (a.Status == (false)) select a).ToList();
if (ddd!=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);
}
}
return View();
}
}
Reply
Answers (
2
)
flask session in python
What are the Final Features Of .NET Standard 2.0 ?