How to update Set-Cookie details - WeOnlyDo Discussion board

How to update Set-Cookie details (wodWebServer / wodWebServer.NET)

by Balaji Remala, Thursday, December 14, 2023, 13:36 (72 days ago)

We are using wodWebServerCom(version 1.7.0.364) in VB5.0.

We need help, to update the Cookie with HTTPOnly and Secure details.

In Response Header by default, we are getting Set-Cookie details with default values as below:
Set-Cookie- <Cookie-Name =SessionID>; <Path>: <expires=Date>:

Expecting:
Set-Cookie- <Cookie-Name =SessionID>; <Path>:<expires=Date>:HttpOnly; Secure=True;

How to update Set-Cookie details

by Jasmine, Thursday, December 14, 2023, 14:04 (72 days ago) @ Balaji Remala

Hi.

Why don't you try with Response.Headers.Add("Set-Cookie.....") where you can put raw cookie in response?

Regards,
Jasmine

How to update Set-Cookie details

by Balaji Remala, Thursday, December 14, 2023, 14:50 (72 days ago) @ Jasmine

Hi.

Why don't you try with Response.Headers.Add("Set-Cookie.....") where you can put raw cookie in response?

Regards,
Jasmine

Hi,
Thank you for your quick response.
Using the Response.Headers.Add ("Set-Cookie:...") I am able to add the cookie. But at final I am seeing 2 Set-Cookie under the Response Header, another Set-Cookie is adding by itself, I am not able to update this default cookie with HTTPOnly and Secure details.
I want to update all the cookies with HTTPOnly and Secure details.

Thanks,
Balaji

How to update Set-Cookie details

by Jasmine, Friday, December 15, 2023, 09:00 (72 days ago) @ Balaji Remala

Balaji,

what would be 'default cookie'? Are you interfering with session cookie WODSESSIONID?

Jasmine

How to update Set-Cookie details

by Balaji Remala, Friday, December 15, 2023, 13:24 (71 days ago) @ Jasmine

Balaji,

what would be 'default cookie'? Are you interfering with session cookie WODSESSIONID?

Jasmine

Hi,
Yes, default Cookie name is WODSESSIONID.

Default Cookie Format:
Set-Cookie: WODSESSIONID=<>; path=/; expires=<>

I am expecting to edit the above default cookie details.
Thanks,
Balaji.

How to update Set-Cookie details

by Jasmine, Friday, December 15, 2023, 13:30 (71 days ago) @ Balaji Remala

I think best approach would be to add ResponseHeaders event, that would fire after we have created headers, but before they are sent out, so you can change them as you wish.

Would that work for you? We would need a day or two to implement this.

Regards,
Jasmine

How to update Set-Cookie details

by Balaji Remala, Friday, December 15, 2023, 15:17 (71 days ago) @ Jasmine

I think best approach would be to add ResponseHeaders event, that would fire after we have created headers, but before they are sent out, so you can change them as you wish.

Would that work for you? We would need a day or two to implement this.

Regards,
Jasmine

Hi
Thank you for your inputs.
That sounds fine for me, please share the sample code.
Thank you,
Balaji.

How to update Set-Cookie details

by Jasmine, Friday, December 15, 2023, 18:49 (71 days ago) @ Balaji Remala

Hi.

Please request update and try it out. Version property should return 1.7.2. You should add code like this to achieve what you need:


Private Sub Web1_ResponseHeaders(ByVal User As WODWEBSERVERCOMLib.IWebUser)
    User.Response.Headers("Set-Cookie").Value = User.Response.Headers("Set-Cookie").Value + "; HttpOnly"
End Sub

Of course, add little sanity checking inside, just in case.

Let me know if this works ok for you!

Jasmine

How to update Set-Cookie details

by Balaji Remala, Tuesday, December 19, 2023, 13:18 (67 days ago) @ Jasmine

Hi.

Please request update and try it out. Version property should return 1.7.2. You should add code like this to achieve what you need:


Private Sub Web1_ResponseHeaders(ByVal User As WODWEBSERVERCOMLib.IWebUser)
User.Response.Headers("Set-Cookie").Value = User.Response.Headers("Set-Cookie").Value + "; HttpOnly"
End Sub

Of course, add little sanity checking inside, just in case.

Let me know if this works ok for you!

Jasmine

Hi Jasmine,
Thank you for your support.
wodWebServerCom Version is 1.7.0.364.
I am using IwodWebNotify events. I have not found IwodWebNotify_ResponseHeaders event.
There is only IwodWebNotify_ResponseDone, IwodWebNotify_RequestDone and IwodWebNotify_RequestHeaders.
Thank you,
Balaji

How to update Set-Cookie details

by Jasmine, Tuesday, December 19, 2023, 13:42 (67 days ago) @ Balaji Remala

Hi.

We have implemented this event for you. You must update to the latest version from our website. Please request update and try it out.

Jasmine