Syntax Rommel
Syntax Rommel

Reputation: 942

Setting up cookie options

Creating simple method and seems like the 'cookieOptions' function are not working and Im getting stack on its reference prerequisites.

May I know what reference or module needs to be import to enable the capability of this

Here is the sample method:

public void SetCookie(string key, string value, int? expireTime)
{
    CookieOptions option = new CookieOptions(); /// => Missing reference here      
}

And here is the returning error:

'CookieOptions' could not be found (are you missing a using directive or an assembly reference?)

Any suggestions/comments TIA

Upvotes: 1

Views: 2923

Answers (2)

Athanasios Kataras
Athanasios Kataras

Reputation: 26430

I'm assuming that you are using net core (nothing like this in .net framework)

Namespace:

Microsoft.AspNetCore.Http

Assembly:

Microsoft.AspNetCore.Http.Features.dll

https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.http.cookieoptions?view=aspnetcore-3.0

Upvotes: 2

Marwen Jaffel
Marwen Jaffel

Reputation: 807

Assembly name Microsoft.AspNet.Http.CookieOptions for .net framework If you code .net core you can use this one Microsoft.AspNetCore.Http

Upvotes: 1

Related Questions