asp.net - Call function from code behind in Global.asax -


how can access control or function asp page (code behind) in global.asax?

i use below code background task, code check new emails every 60 seconds , want update label show new email's count in default.aspx

void application_start(object sender, eventargs e)  {     addtask("checkemails", 10); }  private void addtask(string name, int seconds) {     oncacheremove = new cacheitemremovedcallback(cacheitemremoved);     httpruntime.cache.insert(name, seconds, null, datetime.now.addseconds(seconds), cache.noslidingexpiration,     cacheitempriority.notremovable, oncacheremove);  }//addtask   public void cacheitemremoved(string k, object v, cacheitemremovedreason r)  {     //check new emails , update label .aspx     addtask(k, convert.toint32(v));  }//cacheitemremoved 

create seperate class common function, put in app_code folder, access function default.aspx , global.asax....


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -