AppHarbor.Web.Security.AuthenticationCookie.Renew C# (CSharp) Method

Renew() public method

public Renew ( ) : void
return void
		public void Renew()
		{
			_issueDate = DateTime.UtcNow;
		}

Usage Example

		private void RenewCookieIfExpiring(HttpContext context, CookieProtector protector, AuthenticationCookie authenticationCookie)
		{
			if (!_configuration.SlidingExpiration || !authenticationCookie.IsExpired(TimeSpan.FromTicks(_configuration.Timeout.Ticks / 2)))
			{
				return;
			}
			authenticationCookie.Renew();
			context.Response.Cookies.Remove(_configuration.CookieName);
			var newCookie = new HttpCookie(_configuration.CookieName, protector.Protect(authenticationCookie.Serialize()))
			{
				HttpOnly = true,
				Secure = _configuration.RequireSSL,
			};
            if (!string.IsNullOrEmpty(_configuration.Domain))
            {
                newCookie.Domain = _configuration.Domain;
            }
            var expireDateTime = authenticationCookie.IssueDate + _configuration.Timeout;
            if (authenticationCookie.Persistent)
            {
                newCookie.Expires = expireDateTime;
            }
			context.Response.Cookies.Add(newCookie);

            RenewTrackExpireTimeCookie(context, expireDateTime);
		}
All Usage Examples Of AppHarbor.Web.Security.AuthenticationCookie::Renew