i use cookie utility where i create delete and read my cookie
this is my code
public static void CreateCookie(string CookieName, string[] keys, string[] values, bool Expired, HttpResponse res)
{
HttpCookie c = new HttpCookie(CookieName);
if (keys != null)
{
for (int x = 0; x < keys.Length; x++)
c.Values.Add(keys[x], values[x]);
if (!Expired)
c.Expires = DateTime.Now.AddDays(2);
}
else
c.Expires = DateTime.Now.AddDays(-2);
res.Cookies.Add(c);
}
public static string ReadFromCookie(string CookieName, string key, HttpRequest req)
{
try
{
return req.Cookies[CookieName][key].ToString();
}
catch
{
return null;
}
}
public static void RemoveCookie(string CookieName, HttpResponse res)
{
CreateCookie(CookieName, null, null, false, res);
}
in my login page i create cookie by this code
protected void btnLogin_Click(object sender, EventArgs e)
{
Member m = new Member();
if (m.Login(Txtuser.Text, Txtpass.Text))
{
utility.CreateCookie("login", new string[] { "user", "pass" }, new string[] { Txtuser.Text, Txtpass.Text }, ChkReM.Checked, Response);
Redirect(Txtuser.Text);
}
else
lblmsg.Text = "Username/password incorrect";
}
private void Redirect(string user)
{
if (user == "Admin")
Response.Redirect("Admin/Admin.aspx");
else
{
Response.Redirect("Users/UserInfo.aspx");
}
}

Sanjeeb LenkaRank #301 · 8.3K reputationPosted Jul 20, 2013, 11:03 AM EDT
http://rollercoasters-bunker.blogspot.in/2008/07/secureencrypted-cookies-in-aspnet-with.html
http://www.c-sharpcorner.com/UploadFile/manishkdwivedi/encrypting-and-decrypting-cookies-in-Asp-Net-2-0/
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 20, 2013, 8:33 PM EDT
Please refer the below link
http://martijnvanschie.blogspot.in/2009/07/encrypted-cookies-using-aspnet.html
Regards,
Iftikar
alaa157 reputationPosted Jul 21, 2013, 5:35 AM EDT
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 21, 2013, 7:14 PM EDT
Regards,
Iftikar
alaa157 reputationPosted Jul 22, 2013, 2:08 AM EDT
this is my code
protected void btnLogin_Click(object sender, EventArgs e)
{
Member m = new Member();
if (m.Login(Txtuser.Text, Txtpass.Text))
{
CookieUtil.SetTripleDESEncryptedCookie("login", Txtuser.Text, DateTime.Now.AddDays(2));
Redirect(Txtuser.Text);
}
else
lblmsg.Text = "Username/password incorrect";
}
private void Redirect(string user)
{
Response.Redirect("Users/UserInfo.aspx?=n "+Txtusername.Text+"&g="+txtpass.Text");
}
}
it appears the value not encrypt despite the value is really encrypt
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 22, 2013, 2:12 AM EDT
Regards,
Iftikar
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 22, 2013, 2:13 AM EDT
Regards,
Iftikar
alaa157 reputationPosted Jul 22, 2013, 5:41 AM EDT
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 22, 2013, 5:43 AM EDT
Regards,
Iftikar
Deepak VermaRank #672 · 3.6K reputationPosted Jul 22, 2013, 5:51 AM EDT
http://www.c-sharpcorner.com/UploadFile/manishkdwivedi/encrypting-and-decrypting-cookies-in-Asp-Net-2-0/
alaa157 reputationPosted Jul 22, 2013, 5:58 AM EDT
*********************************
http://www.c-sharpcorner.com/UploadFile/manishkdwivedi/encrypting-and-decrypting-cookies-in-Asp-Net-2-0/
does it also use the same code/class in ASP.NET 4.0 or 4.5?
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 22, 2013, 6:01 AM EDT
Regards,
Iftikar
alaa157 reputationPosted Jul 22, 2013, 6:18 AM EDT
http://www.c-sharpcorner.com/UploadFile/manishkdwivedi/encrypting-and-decrypting-cookies-in-Asp-Net-2-0/
does it also use the same code/class in ASP.NET 4.0 or 4.5?
i read some comments that itisnt support !!!!
alaa157 reputationPosted Jul 22, 2013, 2:48 PM EDT
http://rollercoasters-bunker.blogspot.com/2008/07/secureencrypted-cookies-in-aspnet-with.html
http://martijnvanschie.blogspot.in/2009/07/encrypted-cookies-using-aspnet.html