473,473 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Hooking into Application objects

I am trying to write a static utility class that allows me to modify
Application variables in my web application.

My problem is that I cannot figure out what to import or inherit to
allow me to see application objects or even the server object.

Here is my code:

Public Shared RefreshCachedXMLDatasets()

Dim dsLinks As New DataSet()
'-- Cached XML Menu
dsLinks = New DataSet()
dsLinks.ReadXml(Server.MapPath(Utilities.GetConfig Value("XMLMenuFilename",
"")))
Application("CACHED_XML_MENU") = dsLinks

'-- Cached Portfolio
dsLinks = New DataSet()
dsLinks.ReadXml(Server.MapPath(Utilities.GetConfig Value("XMLPortfolioFilename",
"")))
Application("CACHED_XML_PORTFOLIO") = dsLinks
End Sub

The application object or server object do not exsist.
Any Suggestions?
Nov 20 '05 #1
2 1114
Hi Brian,

I would suggest implementing this class as an amended singleton. It would
have an Initialize method creating the sole instance which would accept the
Application object as the argument. This method would be called upon
Application_OnStart. Then, it would have the standard singleton Instance
property to access the sole instance. This instance will have been
pre-initialized with a reference to the application object by the moment you
will be accessing it for the first time.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Brian Bender" <br***********@hotmail.com> wrote in message
news:b7**************************@posting.google.c om...
I am trying to write a static utility class that allows me to modify
Application variables in my web application.

My problem is that I cannot figure out what to import or inherit to
allow me to see application objects or even the server object.

Here is my code:

Public Shared RefreshCachedXMLDatasets()

Dim dsLinks As New DataSet()
'-- Cached XML Menu
dsLinks = New DataSet()
dsLinks.ReadXml(Server.MapPath(Utilities.GetConfig Value("XMLMenuFilename", "")))
Application("CACHED_XML_MENU") = dsLinks

'-- Cached Portfolio
dsLinks = New DataSet()
dsLinks.ReadXml(Server.MapPath(Utilities.GetConfig Value("XMLPortfolioFilenam
e", "")))
Application("CACHED_XML_PORTFOLIO") = dsLinks
End Sub

The application object or server object do not exsist.
Any Suggestions?


Nov 20 '05 #2
Dmitriy,

I uderstand what you are saying. i am familiar with singleton. However
isn't there a built in way to do this. All webforms are classes and
they see these objects. How do they do it? It has got to be some type
of import or inheritance.
Nov 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Matthew Kelly | last post by:
I have pulled together a VB.net project that hooks the keyboard (Ref. Paul Kimmel's hooking program) and allow the user to send "mouse right clicks" via the SendInpuut function (mouse emulation...
1
by: Matthew Kelly | last post by:
I have pulled together a VB.net project that hooks the keyboard (Ref. Paul Kimmel's hooking program) and allow the user to send "mouse right clicks" via the SendInpuut function (mouse emulation...
5
by: Ryan Ginstrom | last post by:
Apropos recent threads about GUI editors, coming from a Win32/WTL C++ background, I actually like the idea of being able to (easily) create GUIs programmatically. But I still see a lot of the...
8
by: pigeonrandle | last post by:
Hi, Has anyone had any experience with hooking messages in other application windows (like SPY++). I want to listen for WM_MOVE messages, but can only seem to find examples of Keyboard and Mouse...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.