How to modify .Aspnetcore.Identity.Application Cookie name?

Zang-Ho Bae 26 Reputation points
2021-01-05T11:10:14.757+00:00

I wanna hide that i use ASP.NET Core.

How to do this?

Developer technologies ASP.NET ASP.NET Core
0 comments No comments
{count} votes

Accepted answer
  1. Michael Taylor 60,161 Reputation points
    2021-01-05T15:13:31.787+00:00

    Can you not just set the cookie name as part of your AddAuthentication call?

    csharp
    services.AddAuthentication()
                .AddCookie(options => {
       options.CookieName = "MyAuth.Cookie"
    });
    
    1 person found this answer helpful.

2 additional answers

Sort by: Most helpful
  1. hasan hüseyin topal 5 Reputation points
    2024-06-13T03:37:16.9333333+00:00

    I dont know why but you cant rename cookie name with AddCookie(options...) you have to do

    builder.Services.ConfigureApplicationCookie(opt =>{
    opt.Cookie.Name = "YourCookieName";
    });
    
    1 person found this answer helpful.
    0 comments No comments

  2. Michael Taylor 60,161 Reputation points
    2021-01-06T16:17:56.2+00:00

    .NET 5 is just .NET Core 4 renamed to avoid confusion. What is the cookie name you're seeing?


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.