如何在SignalR Hub中读取多值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>]
}