Jump to content

Recommended Posts

Posted

*//############################################################

*//Creates and prepares the cookie jar

*//############################################################

*void Cookie_CreateJar(){

**CookieJar = Request.Cookies[Cookie_ContainerName];

**if(CookieJar==null){

***CookieJar = new HttpCookie(Cookie_ContainerName);

***CookieJar.Expires = DateTime.Now.AddDays(Cookie_ExpiresDaysFromNow);

***Response.Cookies.Add(CookieJar);

**};

*}

*//############################################################

*//Deletes and breaks the cookie jar

*//############################################################

*void Cookie_BreakJar(){

**HttpCookie tempJar = Request.Cookies[Cookie_ContainerName];

**if(tempJar!=null){

***tempJar.Expires = DateTime.Now.AddDays(-1);

***Response.Cookies.Add(tempJar);

**};

*}

*//############################################################

*//Creates (bakes) a cookie in the cookie jar

*//############################################################

*void Cookie_Bake(string cName, string cValue){

**HttpCookie tempJar = Request.Cookies[Cookie_ContainerName];

**if(tempJar!=null){

***if(Cookie_Use(cName)!=cValue){

****//This line adds more values to ONE cookie name :

****//tempJar.Values.Add(cName, cValue);

****tempJar.Values[cName] = cValue;

****Cookie_Update(tempJar);

***};

**};

*}

*//############################################################

*//Deletes (eats) a cookie from the cookie jar

*//############################################################

*void Cookie_Eat(string cName){

**HttpCookie tempJar = Request.Cookies[Cookie_ContainerName];

**if(tempJar!=null){

***tempJar.Values.Remove(cName);

***Cookie_Update(tempJar);

**};

*}

*//############################################################

*//Gets the cookie value

*//############################################################

*string Cookie_Use(string cName){

**HttpCookie tempJar = Request.Cookies[Cookie_ContainerName];

**if(tempJar!=null){

***if(tempJar[cName]!=null){

****return tempJar[cName].ToString();

***}else{

****return "";

***}

**}else{

***return "";

**};

*}

 

More...

 

View All Our Microsoft Related Feeds

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...