locked
How to Add more than one cookie to the header RRS feed

  • Question

  • User-787029301 posted

    I still have some question.

    when i add a cookie to the header in the event SF_NOTIFY_SEND_RESPONSE pSendResponse->AddHeader(pfc,_T("Set-Cookie:"),_T("Cookie1=test;path=\;\r\n"));

    IIS surport this work.

    But I want to add more cookies to the header , i always get the fault result. who can help me?

    My Code:

    DWORD OnSendResponse(HTTP_FILTER_CONTEXT *pfc,
          PHTTP_FILTER_SEND_RESPONSE pSendResponse)

    {

     pSendResponse->AddHeader(pfc,_T("Set-Cookie:"),_T("Cookie1=test;path=\;\r\n"));

    pSendResponse->AddHeader(pfc,_T("Set-Cookie:"),_T("Cookie2=test;path=\;\r\n"));

    return SF_STATUS_REQ_NEXT_NOTIFICATION

    }

    Sunday, March 8, 2009 3:24 AM

Answers

  • User511787461 posted

    You should not have the \r\n in the header value.

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Monday, March 9, 2009 1:01 AM

All replies

  • User-787029301 posted

    IIS5.0

    I USe

    pSendResponse->AddHeader(pfc,_T("Set-Cookie:"),_T("Cookie1=test;path=\;\r\n"));

    the client can get the cookie.

    BUT in IIS6.0

    I alway get the GetLastError 87(parameter is not correct).

    I do not know why.

    Sunday, March 8, 2009 8:32 AM
  • User511787461 posted

    You should not have the \r\n in the header value.

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Monday, March 9, 2009 1:01 AM
  • User-787029301 posted

    Thanks Anilr.

    I still have a problem.

    If i want to add more than one cookie to header. How can  i do it?

    Monday, March 9, 2009 2:20 AM