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
Mark Tabor
590
2k
457.3k
My lines are not executing where i am setting session in asp.net mvc
May 1 2021 7:52 AM
Hi the Lines where i am setting session are not executing while i debug the application
if (!string.IsNullOrEmpty(loginViewModel.Email_Address) && !string.IsNullOrEmpty(loginViewModel.Password))
{
var Username = loginViewModel.Email_Address;
var password = EncryptionLibrary.EncryptText(loginViewModel.Password);
var result = _IStudent.ValidateUser(Username, password);
string sName = result.Student_FName;
Session["UserName"] = sName;
var urls = _IStudent.GetImageURL(Username);
Session["PthUrl"] = urls;
if (result != null)
{
if (result.Student_Id == 0 || result.Student_Id < 0)
{
ViewBag.errormessage = "Entered Invalid Username and Password";
}
else
{
//var RoleID = result.RoleID;
remove_Anonymous_Cookies(); //Remove Anonymous_Cookies
}
// Session["RoleID"] = Convert.ToString(result.RoleID);
Session["Username"] = Convert.ToString(result.Student_FName);
Session["UserID"] = Convert.ToString(result.Student_Id);
Session["StudentEmailAddress"] = Convert.ToString(result.Student_Email);
Session["UserType"] = Convert.ToInt32(result.User_type);
if (!string.IsNullOrEmpty(url))
{
return Redirect(url);
}
else
{
return RedirectToAction("Dashboard", "StudentLogin");
}
}
else
{
ViewBag.errormessage = "Email Address and password are not valid Or the administrator did not activate your account ! contact the system administrator";
return
Reply
Answers (
2
)
Am getting error while connecting by db with visual studio 2019
Store & use Two different Types of database in asp.net MVC