Generate sessionId with and without cookie support