mercredi 22 mars 2017

set the different cookie in development and production in asp.net core

I want to set all cookie httponly = false in development, but httponly = true in production,and other property Domain,Secure.how to write in startup.cs

public class CookieHelper
{
    // ....
    public void SetCookie(string name, string value, TimeSpan timeSpan)
    {
        _accessor.HttpContext.Response.Cookies.Append(name, value, new CookieOptions() { Expires = DateTime.Now.Add(timeSpan) });
    }
}

Aucun commentaire:

Enregistrer un commentaire