Need an Help Getting Error because cookie name has space

maneeshk

New member
Joined
Oct 20, 2020
Messages
1
Programming Experience
1-3
hello forum ,
this is my cookie
xyz session=;
provider_pool=1606944522.20480.0000"

you can see that there are two cookie but first one cookie(xyz session) contain space in it's name
in c# cookiecontainer library class does not allow a cookie name which contain space .
Can you please help me how to handle this issue.
 
Sounds like an invalid cookie to me.
RFC 6265 Section 4.1.1 says:
Informally, the Set-Cookie response header contains the header name "Set-Cookie" followed by a ":" and a cookie. Each cookie begins with a name-value-pair, followed by zero or more attribute-value pairs. Servers SHOULD NOT send Set-Cookie headers that fail to conform to the following grammar:

Code:
set-cookie-header = "Set-Cookie:" SP set-cookie-string
set-cookie-string = cookie-pair *( ";" SP cookie-av )
cookie-pair       = cookie-name "=" cookie-value
cookie-name       = token
:
token             = <token, defined in [URL='https://tools.ietf.org/html/rfc2616#section-2.2'][RFC2616], Section 2.2[/URL]>

RFC 2616, Section 2.2 says this:
Code:
token          = 1*<any CHAR except CTLs or separators>
separators     = "(" | ")" | "<" | ">" | "@"
               | "," | ";" | ":" | "\" | <">
               | "/" | "[" | "]" | "?" | "="
               | "{" | "}" | SP | HT
 

Latest posts

Back
Top Bottom