hi,
ihave this code in c# for crating cookies :
if (saveInCokies_CheckBox.Checked)
{
HttpCookie myCookie = new HttpCookie("AtterehWebCookies");
myCookie["userName"] = userName_TextBox.Text.Trim();
myCookie["password"] = password_TextBox.Text.Trim();
if(employee_RadioButton.Checked)
myCookie["loginType"] = "employee";
else if(lawyer_RadioButton.Checked)
myCookie["loginType"] = "lawyer";
else if(customer_RadioButton.Checked)
myCookie["loginType"] = "customer";
Response.Cookies.Clear();
Response.Cookies.Add(myCookie);
Response.Cookies["AtterehWebCookies"].Expires = DateTime.Now.AddDays(30);
}
after that i want to read that cookies then iused this code:
if (Request.Cookies["AtterehWebCookies"] != null)
{
if (Request.Cookies["AtterehWebCookies"]["userName"] != null &
Request.Cookies["AtterehWebCookies"]["password"] != null &
Request.Cookies["AtterehWebCookies"]["loginType"] != null)
{
userName_TextBox.Text = Request.Cookies["AtterehWebCookies"]["userName"];
password_TextBox.Text = Request.Cookies["AtterehWebCookies"]["password"];
if (Request.Cookies["AtterehWebCookies"]["loginType"].Equals("employee"))
{
employee_RadioButton.Checked = true;
lawyer_RadioButton.Checked = false;
customer_RadioButton.Checked = false;
}
else if (Request.Cookies["AtterehWebCookies"]["loginType"].Equals("lawyer"))
{
lawyer_RadioButton.Checked = true;
employee_RadioButton.Checked = false;
customer_RadioButton.Checked = false;
}
else if (Request.Cookies["AtterehWebCookies"]["loginType"].Equals("customer"))
{
customer_RadioButton.Checked = true;
lawyer_RadioButton.Checked = false;
employee_RadioButton.Checked = false;
}
login_Button_Click(sender, e);
}
}
this two codes worked will for period of time but after that they does not worke and always give me Request.Cookies["AtterehWebCookies"] != null
any one can helpe me plz i thik that after 30 days the cookies are Expired what should i to do to let it worke again