简体   繁体   中英

what's the alternative of RequestCookieCollection and ResponseCookies in .net core 3.1?

after migration from 2.2 to 3.1, ResponseCookies and RequestCookieCollection protection level was changed. what is the alternative in 3.1 ? enter image description here

According to this github post, https://github.com/dotnet/aspnetcore/issues/18193 , RequestCookieCollection() was deliberately made internal so you have to use the interface IRequestCookieCollection.

If you notice, Visual studio auto suggests using the interface in both situations.

Visual Studio 自动建议使用 IResponseCookies 代替 ResponseCookies

Visual Studio 自动建议使用 IRequestCookieCollection 代替 RequestCookieCollection

You can either use the interface or copy the implementation code and use it directly but that leaves you with possibility of a change being introduced that makes the copied code out of date.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM