Sending Data via Session At Index

Looking at the LR i know that I can send a Message box to all Sessions from my app class.

For i As Integer = 0 To App.SessionCount-1 App.SessionAtIndex(i).MsgBox("App shutdown.") Next end

What about it I need to send data to a text label on a webpage.?

Something like

For i As Integer = 0 To App.SessionCount-1 App.SessionAtIndex(i).MyWebPage.MyTextLabel=("Blah Blah Blah") Next end


Yes. That looks right.
Just I would put stuff in temporary variables, so you can check for nil.

It should work as Christian said.
I’ve got an example project here that demonstrates similar things. Send messages do different sessions.

With the exception of a Msgbox for some reason it appears that you can only interact with a webpage control using sessionatindex or session.indentifier from within another page session and not from the App class.

Try anything other than a Msgbox just can’t seem to get working.

Take a look at my example it changes a Label for a selected session

Hi Albin

I did look at the example which is based upon the Push Example Project. Interacting with a Webpage session from a seperate Webpage session works all well and good. The problem that I am having it interacting with a Webpage session from the Project App class.

If you look at my example app DemoWebApp_zip may explain the problem I am experiencing.

I have added a Timer class to the Project (not the Webpage) and a text label to a Webpage. The current timer event action is:

For i As Integer = 0 To App.SessionCount-1 App.SessionAtIndex(i).MsgBox("This is a message.") Next
//Send messagebox to all webpage sessions - This works ok

I am needing to change the text label to all Webpage sessions again from within the Timer.

For i As Integer = 0 To App.SessionCount-1 App.SessionAtIndex(i).Webpage.All.Sessions.Label.Text="My_String" Next

Thanks for your help

Aah, so you’re trying to make the app class send a message to Label1 on WebPage1 for all connected users using SessionAtIndex?


I changed

App.SessionAtIndex(i).MsgBox("This is a message.")

in your example to:

App.SessionAtIndex(i).WebPage1.Label1.text = "This is a message."

and it works just fine :slight_smile:

Hope I’m not misunderstanding…again :wink:

:slight_smile: lol no it’s me just having a blonde moment again.

Thanks that works great. - Getting a little confused between session.Identifier and Sessionindex

I know that I can get the session.Indentifier on a Webpage open event like

Label1.text = session.indentifier but what about the session index?

IE: Label1.Text = Session.Index

[quote=11062:@Lee Page]:slight_smile: lol no it’s me just having a blonde moment again.
We all have those moments :slight_smile: