Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我已使用此代码检查请求中是否存在某些 cookie:
if (Request.Cookies.AllKeys.Contains("action")
但此代码在 .net 框架 2.0 中不起作用,因为System.Array不包含Contains. 除了迭代之外,最简单的事情是什么AllKeys?
System.Array
Contains
AllKeys
您可以使用名称作为索引在Cookies集合本身上检查它,并避免访问AllKeys:
if (Request.Cookies["action"] != null)