User-2053220893 posted
I faced a problem to set multiple cookies in ISAPI filter. I want to add "HttpOnly" and "Secure" flag into all cookies.
Firstly, I split the cookies (comma delimited) and add the flags, then combine them into one string, invoke "pResponse->SetHeader(pfc, "Set-Cookie:", szNewValue)" in the end. I can see on Fiddler that the first cookie got all the string concatenated
and the others cookies were not changed. I'm using IIS 6.
Example:
In ASP Page
<%
Response.AddHeader "Set-Cookie", "Cookie1=conteudo1;Expires=Thu, 10 Oct 2013 12:24:57 GMT; Path=/certificados;"
Response.AddHeader "Set-Cookie", "Cookie2=conteudo2;Expires=Thu, 10 Oct 2013 12:24:57 GMT; Path=/certificados; HttpOnly"
Response.AddHeader "Set-Cookie", "Cookie3=conteudo3;Expires=Thu, 10 Oct 2013 12:24:57 GMT; Path=/certificados; HttpOnly; Secure"
Response.AddHeader "Set-Cookie", "Cookie4=conteudo4; Path=/certificados;"
Response.AddHeader "Set-Cookie", "Cookie5=conteudo5; Path=/certificados; HttpOnly"
Response.AddHeader "Set-Cookie", "Cookie6=conteudo6; Path=/certificados; HttpOnly; Secure"
%>
Response: (Fiddler)
Set-Cookie: Cookie2=conteudo2;Expires=Thu, 10 Oct 2013 12:24:57 GMT; Path=/certificados; HttpOnly
Set-Cookie: Cookie3=conteudo3;Expires=Thu, 10 Oct 2013 12:24:57 GMT; Path=/certificados; HttpOnly; Secure
Set-Cookie: Cookie4=conteudo4; Path=/certificados;
Set-Cookie: Cookie5=conteudo5; Path=/certificados; HttpOnly
Set-Cookie: Cookie6=conteudo6; Path=/certificados; HttpOnly; Secure
Set-Cookie: ASPSESSIONIDCCDDQQCA=BLNLIMFBBIFADMEHANNNBONI; path=/
Set-Cookie: Cookie1=conteudo1;Expires=Thu, 10 Oct 2013 12:24:57 GMT; Path=/certificados; HttpOnly; Secure,Cookie2=conteudo2;Expires=Thu, 10 Oct 2013 12:24:57 GMT; Path=/certificados; HttpOnly; Secure,Cookie3=conteudo3;Expires=Thu, 10 Oct 2013 12:24:57 GMT; Path=/certificados; HttpOnly; Secure,Cookie4=conteudo4; Path=/certificados; HttpOnly; Secure,Cookie5=conteudo5; Path=/certificados; HttpOnly; Secure,Cookie6=conteudo6; Path=/certificados; HttpOnly; Secure,ASPSESSIONIDCCDDQQCA=BLNLIMFBBIFADMEHANNNBONI; path=/; HttpOnly; Secure
Thanks in advance