D
damian.jolly
Is persisting objects to the SESSION the best way to prevent an object
from being created every time a page is refreshed?
It's a bit complicated but I'll try to be brief...
I am using a guage from Fusion Charts Instrumentation Suite to show the
speed of machinary in a factory. The guage updates every 5 seconds.
The guage update does not cause a refresh of the page that it is on,
however it allows the definition of a DataStreamUrl and RefreshInterval
properties that poll a data provider .aspx page that constantly returns
the updated value in the form of &value=x
This data provider page creates a OPCDataProvider object that has
properties and methods that can retrieve data from machinery in the
factory. Each time this page is polled, it is refreshed.
To prevent the object (and it's connection to the OPC Server) from
being created every 5 seconds, I persist the object with the SESSION
command...
Imports System.text
Namespace SAGEFrontline.Portal
Public Class DataProvider
Inherits System.Web.UI.Page
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim OPCDataProvider As SAGEFrontline.Portal.OPCDataProvider
If Session("OPCDataProder") Is Nothing Then
OPCDataProvider = New
SAGEFrontline.Portal.OPCDataProvider
OPCDataProvider.AddOPCItem("Channel_0_User_Defined.Ramp.Ramp1")
Else
OPCDataProvider = CType(Session("OPCDataProder"),
SAGEFrontline.Portal.OPCDataProvider)
End If
Response.Expires = 0
Response.ContentType = "text/xml"
Response.Write("&value=" &
OPCDataProvider.ReadOPCItem("Channel_0_User_Defined.Ramp.Ramp1"))
Session("OPCDataProder") = OPCDataProvider
End Sub
End Class
End Namespace
Is this the best way to handle a server-side object? It seems to work
fine.
Cheers
Damian
from being created every time a page is refreshed?
It's a bit complicated but I'll try to be brief...
I am using a guage from Fusion Charts Instrumentation Suite to show the
speed of machinary in a factory. The guage updates every 5 seconds.
The guage update does not cause a refresh of the page that it is on,
however it allows the definition of a DataStreamUrl and RefreshInterval
properties that poll a data provider .aspx page that constantly returns
the updated value in the form of &value=x
This data provider page creates a OPCDataProvider object that has
properties and methods that can retrieve data from machinery in the
factory. Each time this page is polled, it is refreshed.
To prevent the object (and it's connection to the OPC Server) from
being created every 5 seconds, I persist the object with the SESSION
command...
Imports System.text
Namespace SAGEFrontline.Portal
Public Class DataProvider
Inherits System.Web.UI.Page
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim OPCDataProvider As SAGEFrontline.Portal.OPCDataProvider
If Session("OPCDataProder") Is Nothing Then
OPCDataProvider = New
SAGEFrontline.Portal.OPCDataProvider
OPCDataProvider.AddOPCItem("Channel_0_User_Defined.Ramp.Ramp1")
Else
OPCDataProvider = CType(Session("OPCDataProder"),
SAGEFrontline.Portal.OPCDataProvider)
End If
Response.Expires = 0
Response.ContentType = "text/xml"
Response.Write("&value=" &
OPCDataProvider.ReadOPCItem("Channel_0_User_Defined.Ramp.Ramp1"))
Session("OPCDataProder") = OPCDataProvider
End Sub
End Class
End Namespace
Is this the best way to handle a server-side object? It seems to work
fine.
Cheers
Damian