Solved

How To Update Application Var in class-method that I start in Thread

Posted on 2011-03-03
3
907 Views
Last Modified: 2012-06-27
Hi,
My Problem: I need to run a method that constantly updates DB on Application level and alerts clients if there are updates maden, using an Application variabel (a counter) so I
thought, let's set up a Thread in the global.asax, calling the method. But I can't update a Application var in a method (Application does not exist in current context)

in app_code: class CheckIfOpen method: IsOpenForBiding
in global.asax:
Thread th = new Thread(new ThreadStart(CheckIfOpen. IsOpenForBiding));
th.IsBackground = true;
th.Start();
But how do I fit in Application["OnSaleCounter"] ???

Friendly greetings,
Jürgen



0
Comment
Question by:jurgen_thys
  • 2
3 Comments
 
LVL 8

Expert Comment

by:Anurag Agarwal
ID: 35028597
hello jurgen !!

to find Application["OnSaleCounter"] try

Httpcontext.Current.Application["OnSaleCounter"] = value

0
 
LVL 8

Accepted Solution

by:
Anurag Agarwal earned 500 total points
ID: 35028726
Httpcontext exist in system.web thus you may also use system.web.Httpcontext.Current.Application["OnSaleCounter"]
0
 

Author Closing Comment

by:jurgen_thys
ID: 35030094
Thanks very,
Simple if you know it, frustrating if you don't!

Jürgen,
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
Edureka is one of the fastest growing and most effective online learning sites.  We are here to help you succeed.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now