Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Global application object is being reseted
Message
 
To
19/05/2007 11:41:09
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:
01227073
Views:
27
Well yes, as long as your component is thread safe. Remember this object is shared so if there's any state that is accessed it's potentially thread unsafe...


+++ Rick ---

>>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.
>
>Ok, I remove all code from Global.asax. Basically, it's just:
>
>
>< %@ Application Language="VB" % >
>
><script runat=server>
>
></script>
>
>
>Then, in the App class, I have as you said:
>
>
>Imports System.Data.OleDb
>Imports System.Data.SqlClient
>Imports System.Data.Odbc
>
>Namespace Framework
>
>    Public Class App
>        ...
>        Public Shared oApp As Framework.App = New Framework.App()
>        ...
>    End Class
>
>End Namespace
>
>
>In the Web form class, I now have:
>
>
>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
>
>            If Not App.oApp.lInitialize Then
>                App.oApp.nApplicationMode = 3
>                App.oApp.oServer = Server
>                App.oApp.Initialize()
>            End If
>
>            oProcess.oApp = App.oApp
>            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
>
>
>This is working. From that design, as you mentioned, I should now be ok to have the framework object to recreate itself when something will be reseted on the IIS server. Is that correct?
+++ 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