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
Solved

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

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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Calculate number of nights between two dates 5 53
MailAddress in vb 4 29
exporting html table data 4 28
Need a simple RegEx to search for two words 27 45
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

837 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