how to store store username and password using javascript in asp.net.
how to store store username and password in cookie using javascript in asp.net.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Satyapriya NayakPosted Jul 9, 2012, 7:46 AM
Please refer the below links
http://eisabainyo.net/weblog/2009/02/20/store-login-information-in-cookie-using-jquery/
http://stackoverflow.com/questions/8508999/trying-to-save-username-password-in-cookie-jquery
Thanks
Posted Jul 9, 2012, 7:45 AM
Create a cookie object and add it into the Responce.Cookies collection.
[code]
HttpCookie userCookie = new HttpCookie("UserInformation");
userCookie["UserName"] = "username";
userCookie["Password"] = "password";
userCookie.Expires = DateTime.Now.AddDays(1);
Response.Cookies.Add(userCookie);
From Javascript.
[code]
function SetCookie(cookieName,cookieValue,nDays) {
var today = new Date();
var expire = new Date();
if (nDays==null || nDays==0) nDays=1;
expire.setTime(today.getTime() + 3600000*24*nDays);
document.cookie = cookieName+"="+escape(cookieValue)+ ";expires="+expire.toGMTString();
}