I would like to access a particular cookie detail on current force.com site vf page.

When I access the cookie in the controller constructor it returns null?

Controller code:

System.Cookie cookieName = 

Was there any restriction on force.com site? Can anyone help me with this issue? Thanks for your help.


1 Answer 1


This is a design decision made by Salesforce (don't know why. The documentation for getCookies includes this restriction:


Used in conjunction with the Cookie class. Only returns cookies with the “apex__” prefix set by the setCookies method.

So you can set and get cookies yourself but at the client side they will automatically have the "apex__" prefix added. This means you can't access the values of cookies that don't have that prefix at the client-side.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.