Access a control or function from asp page in Global.asax
-
How can i access a control or function from asp page in Global.asax? for example call a function from Default.aspx in Global.asax
-
How can i access a control or function from asp page in Global.asax? for example call a function from Default.aspx in Global.asax
Why would you want to do such thing? Global.asax has it's own responsibilities and triggers.
Sandeep Mewara Microsoft ASP.NET MVP 2012 & 2013 [My Blog]: Sandeep Mewara's Tech Journal! [My Latest Article]: HTML5 Quick Start Web Application
-
Why would you want to do such thing? Global.asax has it's own responsibilities and triggers.
Sandeep Mewara Microsoft ASP.NET MVP 2012 & 2013 [My Blog]: Sandeep Mewara's Tech Journal! [My Latest Article]: HTML5 Quick Start Web Application
I implement a background task for check new email in Global and want to update label's text that put in page.aspx from Global
-
I implement a background task for check new email in Global and want to update label's text that put in page.aspx from Global
SajjadZare wrote:
background task for check new email in Global
That's not the right place for some utility method. Create and place a new class in App_Code folder. Expose the method and use it in your pages where needed. Global.asax is not for such things. Please read about it.
Sandeep Mewara Microsoft ASP.NET MVP 2012 & 2013 [My Blog]: Sandeep Mewara's Tech Journal! [My Latest Article]: HTML5 Quick Start Web Application
-
SajjadZare wrote:
background task for check new email in Global
That's not the right place for some utility method. Create and place a new class in App_Code folder. Expose the method and use it in your pages where needed. Global.asax is not for such things. Please read about it.
Sandeep Mewara Microsoft ASP.NET MVP 2012 & 2013 [My Blog]: Sandeep Mewara's Tech Journal! [My Latest Article]: HTML5 Quick Start Web Application
I need to check a function every 60 seconds and do that with below code
void Application_Start(object sender, EventArgs e)
{
AddTask("CheckEmails", 60);
}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 for new emails AddTask(k, Convert.ToInt32(v)); }//CacheItemRemoved