accessing application level objects

Z

Zdravko Stefanov

I have globally declared instance of a .NET CLASS in global.asax. The
declaration goes like this:

<object id="GlobalVar" runat="server" scope="application"
class="MyNamespace.CMyClass" />

I am trying to use it like this in code:

GlobalVar.DoSomething();

but receive error "The type or namespace name 'GlobalVar' could not be found
(are you missing a using directive or an assembly reference?)"

This way of usage was possible in ASP 3.0 and I thought it is possible in
ASP.NET too... Am I wrong? Now I can use the object only as
Application.StaticObjects["GlobalVar"]....

TIA
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,608
Members
45,244
Latest member
cryptotaxsoftware12

Latest Threads

Top