You need to sign in to do that
Don't have an account?
MTBRider
Setting cookies for pages that are not the current page
Does anyone know how to set a cookie for a page that is not the current page? I have page1 calling page2. When page2 is .currentPage(), I want to set a cookie for page1.
I tried doing this:
PageReference page1 = new PageReference('/apex.page1'); Cookie cookieMsg = new Cookie('msg', 'My message', null, -1, false); page1.setCookies(new Cookie[]{cookieMsg});
But that did not work.
Thanks for your help.
Ok, thanks. Based on your information, I went back, took a closer look, and figured out what the problem was. Turns out, the cookie that page2 was trying to set was never getting set because the page2 window was being closed before it had a chance to set the cookie.
Thanks for your help.
All Answers
What are you trying to accomplish? I don't think you're asking the right questions...
I am trying to set a message that page1 can retrieve while in page2. I am trying to do this via a cookie.
Ok, thanks. Based on your information, I went back, took a closer look, and figured out what the problem was. Turns out, the cookie that page2 was trying to set was never getting set because the page2 window was being closed before it had a chance to set the cookie.
Thanks for your help.