Solved

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

Posted on 2011-03-03
3
913 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

691 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