Access Session variables from WebThread

Is it possible to access Session variables from within a WebThread? My app compiles OK, but when it runs it gives a NilObjectException error when reading or updating a Session variable. You can access the Session variables from within the WebPage methods.

I’m not a fan of the Session “pseudo-global” variable. In fact, I’m so not a fan of it that I built an alternative, “mySession”, into Studio Stable Web Essentials. And then I became even less of a fan and made the “mySession” stuff available for free. You can read up on the issue and solution here:

http://www.studiostable.com/webessentials/mysession

And download from our download page.

Thanks Brad, but I don’t understand why we need to do this workaround. I have added the required properties to the WebThread itself, then pass these variables into the Thread before I run the thread. I shall check out your product some more.

You don’t “need to”. Historically, the “Session” pseudo-global has been quite problematic, mostly because its behavior is completely opaque. It’s also confusing when doing Session to Session communications (e.g. push notifications). You’re welcome to use and adapt “mySession” to meet your needs.