WebSessionContext

I know that timers and threads loose their session context unless one is saved. My question is how to you access properties of the session object that are not part of the standard library?

For example, in a Session.Open event the session caches a bunch of pages in properties. On one of these pages there is a http socket that communicates with an external API. Its DataReceived event also needs to create a WebsessionContext to be able to access session, however that session object will not have any of the properties and thus can not access any of the cached pages.

Any thoughts on a way around that?

Hi Erin,

I’ve recently bumped into this or a similar issue while integrating credit card payment gateways into my WebApp. My process left the session entirely to go to the gateway. Upon return from a successful payment ( or unsuccessful ) I created web sessions contexts to access everything that was going on in the previous session a few moments ago. It did work but it was all a bit messy. In the end I wrote everything I needed out to a database and then loaded it back into the newly created session. It was much easier and cleaner to deal with in the end. This may be an option for you ?

My suggestion would be to have the response come in and use a WebSessionContext just set a few variables as to the success or failure of the external transaction and set up a WebTimer In the users session that fires maybe once per second or two to watch for a change in this variables. Once it succeeds (Or family last) turn off the timer and do everything you need to do from within the regular session code again.

Yeah, I ended up using a timer to get back to the correct thread. Seems a bit hacky, but works reliably.

@Barney Hyde what payment gateway were you integrating with?