|
Post by dejohnny on Jan 9, 2013 11:59:36 GMT -5
|
|
|
Post by dejohnny on Mar 18, 2013 9:24:39 GMT -5
|
|
|
Post by dejohnny on Mar 18, 2013 9:55:06 GMT -5
|
|
|
Post by dejohnny on Mar 18, 2013 12:32:16 GMT -5
|
|
|
Post by dejohnny on Mar 18, 2013 16:17:36 GMT -5
|
|
|
Post by dejohnny on Mar 20, 2013 14:29:58 GMT -5
|
|
|
Post by dejohnny on Apr 2, 2013 21:56:39 GMT -5
|
|
|
Post by markspend on Apr 10, 2013 8:23:26 GMT -5
Hey Guys according to that issue i think that if you want to create the persistent cookie on asp.net then you must follow that coding:
//create a cookie HttpCookie myCookie = new HttpCookie("myCookie");
//Add key-values in the cookie myCookie.Values.Add("userid", objUser.id.ToString());
//set cookie expiry date-time. Made it to last for next 12 hours. myCookie.Expires = DateTime.Now.AddHours(12);
//Most important, write the cookie to client. Response.Cookies.Add(myCookie);
|
|
|
Post by dejohnny on Apr 15, 2013 11:31:47 GMT -5
Hey Guys according to that issue i think that if you want to create the persistent cookie on asp.net then you must follow that coding: //create a cookie HttpCookie myCookie = new HttpCookie("myCookie"); //Add key-values in the cookie myCookie.Values.Add("userid", objUser.id.ToString()); //set cookie expiry date-time. Made it to last for next 12 hours. myCookie.Expires = DateTime.Now.AddHours(12); //Most important, write the cookie to client. Response.Cookies.Add(myCookie); That's one way of doing it. You could also write code to check if the cookie exist before you create one. Also, you don't need to use HttpCookie object directly, you could simple use the Request object and reference the name of the cookie by using the following statement: if(!Request.Cookies["cookie_name"]){
var cookie = Request.Cookies["cookie_name"]; cookie["cookie_name"] = "userId"; cookie.Expires = Now.AddDays(1); Response.Cookies.Add(cookie);
}else{ // do something else }
|
|