Running a referance

  • Thread starter Thread starter Zulander
  • Start date Start date
Z

Zulander

Hi,
i have a DLL that i have made, I need the page to keep it running until
the sesssion has ended.
When the users logs in using webcontrol login, i create the object when
the user has loged in but for some reason the object closes and does
not keep running, i know it starts up but it stop's for some reason !!



Partial Class Login
Inherits System.Web.UI.Page
Dim Monitor As FileMonitor.Monitor
Protected Sub Login1_LoggedIn(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Login1.LoggedIn
Dim Monitor As New FileMonitor.Monitor
Monitor.tEnabled = True
End Sub
End Class

thnak you
 
Try storing it in Session State if it is user-specific, or Cache or
Application State if used for ever visitor.

Dim Monitor As New FileMonitor.Monitor
Monitor.tEnabled = True
Session("monitor")=Monitor


to retrieve:

Dim Monitor as FileMonitor.Monitor = DirectCast(Session("monitor"),
FileMonitor.Monitor)
 
What do you mean by, the object does not keep running?

Remember, asp.net is a stateless technology, once a request is
completed, all the objects are gone. If you want to persist some data
then you need to use some state bags, like Session or Cache or
Application memories..
 
Peter,
When you say i need to save it in a session should i still up i in the
Protected Sub Login1_LoggedIn?


This is my actual code:
rotected Sub Login1_LoggedIn(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Login1.LoggedIn
Dim Monitor As New FileMonitor.Monitor
dim Userdir as string

Monitor.Interval = 5000
Monitor.TimeOut = 1
Monitor.DefaultDir = "C:\Inetpub\wwwroot\test\Temp\"
Userdir = Monitor.GeneratedDir
Monitor.tEnabled = True
Session("monitor") = Monitor
end sub

i am still fairly new to asp.net, i know asp!
thank you
 
Back
Top