Set Cookie Time - CSharp System.Web

CSharp examples for System.Web:Cookie

Description

Set Cookie Time

Demo Code


using System.Web;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System;/* ww  w  .j av  a2s . c o m*/

public class Main{

        public static void SetCookieTime(string name,int day)
        {
            var httpCookie = HttpContext.Current.Response.Cookies[name];
            if (httpCookie != null)
                httpCookie.Expires = DateTime.Now.AddDays(day);
        }
}

Related Tutorials