Harry_C
Harry_C

Reputation: 177

Alternative to using options.CookieHttpOnly MVC Core

Visual Studio 2017 tells me that using options.CookieHttpOnly is obsolete when dealing with a session. What shall I use instead? Here is the code part:

        services.AddSession(options =>
        {
            options.IdleTimeout =
            TimeSpan.FromMinutes(20);
           #pragma warning disable CS0618 // Type or member is obsolete
            options.CookieHttpOnly = true;
           #pragma warning restore CS0618 // Type or member is obsolete
        });

Upvotes: 0

Views: 63

Answers (1)

Chris Pratt
Chris Pratt

Reputation: 239240

The option hasn't been removed; it's simply been moved. It's now options.Cookie.HttpOnly.

Upvotes: 2

Related Questions