如何在SignalR Hub中读取多值cookie?
例如:我将Cookie存储为 -
var myCookie = new NameValueCollection();
myCookie.Add("IdOne", "Value1");
myCookie.Add("IdTwo", "Value2");
var webDummyCookie = new CookieHeaderValue("dummyCookie", myCookie);
response.Headers.AddCookies(new CookieHeaderValue[] { webDummyCookie });
如何分别获取IdOne和IdTwo的值?
我可以用SignalR做的所有事情是:
Cookie cookie; //Microsoft.AspNet.SignalR.Cookie
var cookies = Context.Request.Cookies;
if (cookies.TryGetValue(dummyCookie, out cookie) && cookie.Value != null)
{
var receivedCookie = cookie.Value; //Here is the problem, as I can't do .Values[<key>]
}
有谁知道怎么做?
答案 0 :(得分:1)
虽然问题太老了。希望,这会有所帮助。
我使用 SignalR 2.2.1.0 ,以下是解决方案:
public CustomClass: MyClass {
e.g./// heightForRow
}