Reputation: 877
I've been able to store a custom cookie but I'm trying to save it for a session the store it in the database when a form is submitted. I use:
func (c Application) Index(id string) revel.Result {
cookie := http.Cookie{Name: "id", Value: id, Domain: "localhost", Path: "/"}
c.SetCookie(&cookie)
return c.Render()
}
but I cannot access it again. How could I retrieve it in a different function?
Thank you!
Upvotes: 2
Views: 776
Reputation: 877
I was going about it all wrong. Revel sets cookies with the session.
Set:
c.Session[key] = value
Get:
c.Session[key]
Upvotes: 3