[英]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.从 2.2 迁移到 3.1 后,ResponseCookies 和 RequestCookieCollection 保护级别发生了变化。 what is the alternative in 3.1 ?
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.根据这个 github 帖子https://github.com/dotnet/aspnetcore/issues/18193 ,RequestCookieCollection() 是故意在内部进行的,因此您必须使用接口 IRequestCookieCollection。
If you notice, Visual studio auto suggests using the interface in both situations.如果您注意到,Visual Studio auto 建议在两种情况下都使用该界面。
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.您可以使用接口或复制实现代码并直接使用它,但这可能会引入更改,从而使复制的代码过时。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.