ABsoluteMaybe.Identification.CookieUserIdentification.GenerateIdAndSaveToCookie C# (CSharp) Метод

GenerateIdAndSaveToCookie() приватный метод

private GenerateIdAndSaveToCookie ( ) : string
Результат string
        private string GenerateIdAndSaveToCookie()
        {
            var id = GenerateUniqueId();
            var cookie = new HttpCookie("ABsoluteMaybe", id);

            //first remove, then add, in case we've already added this cookie as part of a previous save during this page load.
            Context.Response.Cookies.Remove("ABsoluteMaybe");
            Context.Response.Cookies.Add(cookie);

            //fix up the incoming cookie so that it will load correctly if we need it again during this page load.
            Context.Request.Cookies.Remove("ABsoluteMaybe");
            Context.Request.Cookies.Add(cookie);

            return id;
        }