Guest User

Guest User

  • Tech Writer
  • 611
  • 129.3k

Set Cookies Value In MVC.

Mar 30 2020 2:45 AM
HttpCookie cookie = new HttpCookie("UserDetail");
try
{
//if (ModelState.IsValid == true)
//{
if (RememberMe == true)
{
cookie["FirstName"] = EmailId;
byte[] b = ASCIIEncoding.ASCII.GetBytes(Password);
String EncryptedPassword = Convert.ToBase64String(b);
cookie["Password"] = EncryptedPassword;
cookie.Expires = DateTime.Now.AddDays(1);
HttpContext.Response.Cookies.Add(cookie);
}
else
{
cookie.Expires = DateTime.Now.AddDays(-1);
HttpContext.Response.Cookies.Add(cookie);
}
 
I have set cookies value using c# code. But  I want to get cookies value using jquery code.
 
like that-var emailId
var password=
 
Please solve my issue. 

Answers (3)