I have used set cookies and get cookies
HttpCookie cookie = new HttpCookie("uid");
cookie.Value =user.ID;
cookie.Expires = DateTime.Now.AddDays(1);
Response.Cookies.Add(cookie);
HttpCookie cookie = context.Request.Cookies.Get("uid");
string id = cookie.Value;
In the above code first i have set cookies, but when i try to get cookies value in ashx file(see in the below code) then cookie object is null while this can run easily in aspx file but null in ashx file.