RETRIEVE data from cookies

Hi,

[the documentation on Xojo is poor of example and I have some problem…]

How I can to retrieve data stored in a cookie? (With web app)

I try to use WebRequest.GetCookie(“password”)
in open method of a webpage but I obtain an error…:
“Static reference to istance method: call this on an instance of class WebRequest”

Thank You

Ciao Marco,
you can read and set the cookies with the sessione object

An example:
You want choose a the page to show based on a cookie value (in the example on the pages there is a button to set or unset the cookie

Session.open
if me.Cookies.Value(“test”)=“OK” then
CurrentPage=WebPage2
else
CurrentPage=WebPage1
end if

WebPage1.button1.caption=“Imposta/Set Cookie”
WebPage1.button1.action:
Session.Cookies.Set(“test”,“OK”)

WebPage2.button1.caption=“Rimuovi/Unset Cookie”
WebPage2.button1.action:
Session.Cookies.Remove(“test”)

Now if run the project you will see webPage1
If you press the button and reload the page (so you will start a new session) you will see webPage2. And so on…

Ciao Antonio, grazie!

Well, it work

[ with Session.PrepareSession valore = me.cookies.value(“IlCookieCheCercavo”) ]

Thank you very much!