Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Global application object is being reseted
Message
 
To
18/05/2007 12:24:32
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
VB 8.0
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01226327
Message ID:
01226985
Views:
26
This message has been marked as the solution to the initial question of the thread.
Why this < object > tag?

Create your framework as a static object somewhere and you're done.

public class App
{
public static LXFramework Framework = new LXFramework();
}

then in code (from anywhere)

App.Framework.SomePropertyOrMethod()

That's all that's needed to guarantee application lifetime and inintialization the first time the App class is accessed.


+++ Rick ---

>To provide more information on the topic and to make sure I adjust properly where needed, here is what I have presently:
>
>The Global.asax is like this:
>
>
>< %@ Application Language="VB" % >
>
><object id="LXFramework" runat="server" class="Framework.Framework.App" scope="Application" />
>
><script runat=server>
>
>    Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
>        LXFramework.nApplicationMode = 3
>        LXFramework.oServer = Server
>        LXFramework.Initialize()
>    End Sub
>
></script>
>
>
>So, on the first hit to the Web site, the framework Initialize() is created. This is where all the settings are read.
>
>Then, every page is inheriting from this Web form class:
>
>
>Namespace Framework
>
>    Public Class WebForm
>        Inherits System.Web.UI.Page
>
>        Public oProcess As Framework.LXProcess = New Framework.LXProcess()
>
>        Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
>            oProcess.oApp = Application.StaticObjects.GetObject("LXFramework")
>            oProcess.oRequest = Request
>            oProcess.oResponse = Response
>            oProcess.oServer = Server
>            oProcess.oPage = Me
>            oProcess.BeginRequest()
>        End Sub
>
>        Sub Page_UnLoad(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Unload
>            oProcess.EndRequest()
>        End Sub
>
>        Sub Page_Error(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Error
>            oProcess.ErrorSetup()
>        End Sub
>
>    End Class
>
>End Namespace
>
>
>So, basically, on each hit, my Web site hit process object is created and I assign the framework application object to it. This line does it:
>
>
>oProcess.oApp = Application.StaticObjects.GetObject("LXFramework")
>
>
>But, as I mentioned, after a while, on a specific server, it gets lost. As you mentioned, this has to be enhanced with a static approach so it would reload by itself on the next hit following that reset.
>
>But, I am not sure where exactly I need to apply the static constructor. Basically, what happens is that the Global.asax is read only once, where the Initialize() will be fired at first. And, then, when something is reseted on the server, this application object is destroyed but the Global.asax is not reloaded as it was already once. So, what would you recommend as far as changes go to resolve that issue?
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform