Fixed issue #62

I have provided a generic solution that should be useful to others as well. Added a getState(WebContext) method that would return the state (session id) information.