【发布时间】:2018-12-24 17:55:27
【问题描述】:
我正在从旧的 .net “升级”到 .net core 2.2(显然升级并不容易,因为它是重写)
这个
HttpCookieCollection不再那么容易访问了。对于 .Net Core 2.2 类库,有哪些示例说明如何访问此 cookie 集合?
private static string CollectionToHtmlTable(HttpCookieCollection collection)
{
// Converts HttpCookieCollection to NameValueCollection
var nvc = new NameValueCollection();
foreach (string item in collection)
{
var httpCookie = collection[item];
if (httpCookie != null)
{
nvc.Add(item, httpCookie.Value);
}
}
return CollectionToHtmlTable(nvc);
}
【问题讨论】:
-
基本上这个
HttpCookieCollection在我升级到.net核心的代码中找不到,它在一个类库中 -
你是如何在旧的 .net 中调用
CollectionToHtmlTable的?将您需要拨打的代码分享给我们CollectionToHtmlTable。
标签: c# .net asp.net-core .net-core asp.net-core-mvc