Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
The cookie name is ".AspNetCore.Mvc.CookieTempDataProvider". I would like to change the name of the cookie so that there are clues to the technology that is serving the website.

What I have tried:

I looked here:
public void ConfigureServices(IServiceCollection services)

But found nothing.
Posted
Updated 15-Apr-18 5:47am

C#
services.Configure<CookieTempDataProviderOptions>(options => options.Cookie.Name = "MyTempDataCookie");


Put this in your ConfigureServices method.
 
Share this answer
 
public class Startup
{

    public void ConfigureServices(IServiceCollection services)
    {
       services.AddSingleton<ITempDataProvider, Interfaces.CookieTempDataProvider>();
    }

}

public class CookieTempDataProvider : ITempDataProvider
{
    const string TempDataCookieKey = "MyCookieName";

    public IDictionary<string, object> LoadTempData(HttpContext context)
    {

    }

    public void SaveTempData(HttpContext context, IDictionary<string, object> values)
    {

    }

}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900