Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.Net Web API - GetCookie() returns empty collection

I tried to read a language cookie (which i set on the client) in an ApiController in my backend Web API like this:

var cookieHeaderValue = Request.Headers.GetCookies("lang").FirstOrDefault();

and my request header looks like this: enter image description here

also the line

Request.Headers.GetCookies();

returns an empty Collection... Can anybody tell my why and what i can do against it? Please help

like image 720
JuHwon Avatar asked Apr 23 '14 09:04

JuHwon


Video Answer


1 Answers

The parsing of the CookieHeaderValue will fail because of the '?' in your authentication cookie name. Try to remove the questionmark.

like image 50
Ich Avatar answered Sep 21 '22 15:09

Ich