C# &引用;此上下文中不存在DisallowsSameSiteNone“;
我已将C# &引用;此上下文中不存在DisallowsSameSiteNone“;,c#,.net,samesite,C#,.net,Samesite,我已将SameSiteCookieManager类从本文档复制到我的项目中 我更新/添加了所有引用/包,但当前的最后一个问题是Visual Studio抱怨不允许SameSitenone 警告是: “当前上下文中不存在名称DISALLOWSSAMESITONE” 代码如下: public class SameSiteCookieManager : ICookieManager { private readonly ICookieManager _innerManager; pu
SameSiteCookieManager
类从本文档复制到我的项目中
我更新/添加了所有引用/包,但当前的最后一个问题是Visual Studio抱怨不允许SameSitenone
警告是:
“当前上下文中不存在名称DISALLOWSSAMESITONE”
代码如下:
public class SameSiteCookieManager : ICookieManager
{
private readonly ICookieManager _innerManager;
public SameSiteCookieManager() : this(new CookieManager())
{
}
public SameSiteCookieManager(ICookieManager innerManager)
{
_innerManager = innerManager;
}
public void AppendResponseCookie(IOwinContext context, string key, string value,
CookieOptions options)
{
CheckSameSite(context, options);
_innerManager.AppendResponseCookie(context, key, value, options);
}
public void DeleteCookie(IOwinContext context, string key, CookieOptions options)
{
CheckSameSite(context, options);
_innerManager.DeleteCookie(context, key, options);
}
public string GetRequestCookie(IOwinContext context, string key)
{
return _innerManager.GetRequestCookie(context, key);
}
private void CheckSameSite(IOwinContext context, CookieOptions options)
{
if (options.SameSite == Microsoft.Owin.SameSiteMode.None
&& DisallowsSameSiteNone(context))
{
options.SameSite = null;
}
}
我遗漏了什么?是否复制了方法DisallowsSameSiteNone(IOwinContext上下文)?,链接显示了该文档中的示例方法。