By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,786 Members | 1,131 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,786 IT Pros & Developers. It's quick & easy.

How to access the Global object

P: n/a

I have made a method in Global.asax called from Application_Start event
that loads some cache data from database to Application scope objets.

This is necessary because this is some data from data that don't change
very often.....but it could change.

So I have my method in Global.asax (it can't be Shared because it would
lost Application object scope), and I would like to call it manually to
refresh the cache when necessary.

Other thing I tryed is to move the method to a new class and make it
shared, but "Application" is not recognized.

How can I access Application object from outside Global.asax and use it
in a Shared sub? or How can I call the "Global" object instance from a

This is the method's code :

Public Sub ReCargarCache()


Application(DC.TipoDeOperacion.ToString) =
StoredProcedures.GetIdNameTipoDeOperacion.Tables(0 )
Application(DC.Shipper.ToString) =
Application(DC.Incoterm.ToString) =
Application(DC.MercadoShipper.ToString) =
Application("Consignatario") =
StoredProcedures.GetIdNameProveedorDeServicioBySer vicio(CInt(eTipoDeServicio.eTipoDeServicioConsigna tario)).Tables(0)
Application("Notify") =
Application(DC.Localidad.ToString) =
Application(DC.Puerto.ToString) =
Application("Agente") =
StoredProcedures.GetIdNameProveedorDeServicioBySer vicio(CInt(eTipoDeServicio.eTipoDeServicioAgenteMa ritimo)).Tables(0)
Application(DC.Motonave.ToString) =
Application(DC.Terminal.ToString) =


End Sub


Nov 23 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
On 23 Nov 2005 11:24:08 -0800, "Fabio Cavassini"
<ca********> wrote:
How can I access Application object from outside Global.asax and use it
in a Shared sub? or How can I call the "Global" object instance from a

You could always put this code in a Shared Sub outside of global.asax
and use a different synchronization technique, for instance
Monitor.Enter, Monitor.Exit, or a ReaderWriterLock object.

Nov 24 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.