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
Guest User
Tech Writer
515
46.4k
About Session or Cookies
Jan 23 2021 5:57 PM
Hello,
hope everyone is doing fine.
I need help keeping my session alive in my MVC web application, until User logged out.
My web application should automatically redirect to the dashboard page always.
I tried cookies also (I have first created Session["UserId"] and then kept that Session in cookies), I can see cookies are created in browser, but still my web application is getting log out.
I have created cookies using :
HttpCookie hqloginCookie = new HttpCookie("hqLogin");
//Set the Cookie value.
hqloginCookie.Values["Name"] = Session["Name"].ToString();
hqloginCookie.Values["Email"] = Session["Email"].ToString();
hqloginCookie.Values["UserId"] = Session["UserId"].ToString();
hqloginCookie.Values["Password"] = Session["Password"].ToString();
hqloginCookie.Path = Request.ApplicationPath;
hqloginCookie.Expires = DateTime.Now.AddDays(365);
Response.SetCookie(hqloginCookie);
Response.Cookies.Add(hqloginCookie);
Using Cookies on my dashboard page using :
HttpCookie
cookie
=
HttpContext
.
Request
.
Cookies
.
Get
(
"
hqLogin
"
);
I
Reply
Answers (
3
)
asp.net core selectlist to show multiple text values
User login and Admin login using asp.net mvc 5