Solved

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

Posted on 2011-03-03
3
911 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

730 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