Skip to content

Accessing the cookie collection allocates *alot* #10030

Closed
@davidfowl

Description

@davidfowl
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;

namespace WebApplication254
{
    public class Startup
    {
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.Run(context =>
            {
                var cookie = context.Request.Cookies[".AspNetCore.Cookies"];

                return context.Response.WriteAsync($"Hello World {cookie}");
            });
        }
    }
}

Most of these allocations look unnecessary. In the end, we need a collection that has cookies split into name value pairs.

image

Metadata

Metadata

Assignees

Labels

Perfaffected-very-fewThis issue impacts very few customersarea-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsseverity-nice-to-haveThis label is used by an internal tooltask

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions