Saturday, 04 May 2013 13:54

using HttpCookie in application

Written by 
Rate this item
(0 votes)

HttpCookie is a very good way to store small amount of data
in application/ can access cookie value in
any page once set in a page.cookie can stay for long time in the
user's computer.

in some cases cookies are very useful in to use
cookie in detail -

//fist check whether cookie exists(created before)
HttpCookie Mitsol_HttpCookieComid = Request.Cookies["Mitsol_HttpCookieComId"];

//if exists
if (Mitsol_HttpCookieComid != null)
{ //do anything with the cookie value }

//not exists create new cookie
HttpCookie Mitsol_HttpCookieComId = new HttpCookie("Mitsol_HttpCookieComId");
Mitsol_HttpCookieComId.Value = id.ToString();


Read 2587 times
Super User

Email This email address is being protected from spambots. You need JavaScript enabled to view it.

Latest discussions

  • No posts to display.