Running into a few issues with “Exception Message: Control cannot be created because no session context is available. Create a WebSessionContext object.” This error happens randomly, I’ve been unable to produce when running the IDE so not easily been able to track down when it’s happening, been adding a lot of System.DebugLog to try and help track it down.
Does this logic sound correct
In the Shown event of WebPage I start a WebThread the WebThread has a single line of code which calls a Method, this method gets some data from a database and puts it into a Class Array, the Class Array is a property of the WebPage as is the Method that the WebThread uses.
When I get to the end of the Method being used by the WebThread I use Xojo.Core.Timer.CallLater to call a Method
Xojo.Core.Timer.CallLater(0, WeakAddressOf LoadDataComplete)
So that LoadDataComplete has access to the Session I do
[code] Dim Sess As Session = MySession
Dim Context As WebSessionContext
’ Check Session Defined
If Sess <> Nil Then
' Define Context
Context = New WebSessionContext(Sess)
End If[/code]
LoadDataComplete creates a container, does the container have access to the session?
MySession is defined in the Open Event of the WebPage.
Private mSession As WeakRef
[code]Private MySession As Session
Get
If mSession = Nil or mSession.value = Nil then
Return Nil
Else
Return Session(mSession.Value)
End If
End Get
Set
’ Set Session
mSession = New WeakRef(value)
End Set[/code]
Sub Open()
' Set Session
MySession = Session
End Sub