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
Anand N
NA
19
31.3k
How to store password in cookies?
Oct 17 2012 2:11 AM
plz go through the following code and give solution to me..... Thanks a lot
public partial class Home : System.Web.UI.Page
{
HttpCookie cookie = new HttpCookie("userdetails");
protected void Page_Load(object sender, EventArgs e)
{
if (Request.Cookies["userdetails"] != null)
{
txtUsername.Text = Request.Cookies["userdetails"]["username"];
txtPassword.Text = Request.Cookies["userdetails"]["Password"]; // it is not working
}
if (!IsPostBack)
{
lblViewersCount.Text = "You are the Viewer Number " + Application["ViewersCount"].ToString();
}
}
protected void button_click(object sender, ImageClickEventArgs e)
{
cookie.Values["username"] = txtUsername.Text;
cookie.Values["Password"] = txtPassword.Text; // password value is not assigning to the cookie so while retrieving it is giving null value
cookie.Expires = DateTime.Now.AddDays(1);
Response.Cookies.Add(cookie);
}
}
Reply
Answers (
2
)
using inputbox
Want to learn SSRS,SSAS,SSIS..any book?