Skip to content

Commit 2f94e13

Browse files
author
Elad Zelingher
committed
Fixing ASP.NET Cookie Provider
1 parent a53261a commit 2f94e13

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/net45/Extensions/WampSharp.AspNet.WebSockets.Server/AspNetCookieProvider.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,16 @@ private static CookieCollection GetCookieCollection(HttpContext httpContext)
1515
{
1616
CookieCollection result = new CookieCollection();
1717

18-
foreach (HttpCookie cookie in httpContext.Request.Cookies)
18+
HttpCookieCollection cookies = httpContext.Request.Cookies;
19+
20+
for (int i = 0; i < cookies.Count; i++)
1921
{
20-
result.Add(new Cookie(cookie.Name, cookie.Value));
22+
HttpCookie cookie = cookies.Get(i);
23+
24+
if (cookie != null)
25+
{
26+
result.Add(new Cookie(cookie.Name, cookie.Value));
27+
}
2128
}
2229

2330
return result;

0 commit comments

Comments
 (0)