In website application class.cs method call from global.asax
class file of a method to call from global.asax how to do in website application please tell me
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Jul 16, 2013, 2:12 AM EDT
http://stackoverflow.com/questions/16319154/call-function-in-aspx-cs-page-from-global-asax
Pankaj PandeyRank #642 · 3.7K reputationPosted Jul 16, 2013, 2:19 AM EDT
http://forums.asp.net/t/1563699.aspx
http://quickstarts.asp.net/QuickStartv20/aspnet/doc/applications/globalasax.aspx
manjula d131 reputationPosted Jul 16, 2013, 2:26 AM EDT
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 16, 2013, 2:41 AM EDT
You can do like this
If your class in different project, then include the namespace by using
Regards,
Iftikar
manjula d131 reputationPosted Jul 16, 2013, 3:17 AM EDT
global.asax
void Application_Start(object sender, EventArgs e)
{
System.Timers.Timer myTimer = new System.Timers.Timer();
myTimer.Interval = 60000;
myTimer.AutoReset = true;
myTimer.Elapsed += new System.Timers.ElapsedEventHandler(myTimer_Elapsed);
myTimer.Enabled = true;
}
public void myTimer_Elapsed(----------)
{
clsmail objmail = new clsmail();
objmail.sendmail();
}
clsmail.cs
is
public void sendmail()
{
----
}
i tried this type but i got an error is
the type or namespace name 'clsmail' could not be found are you missing a using directive or an assembly reference?)
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Jul 16, 2013, 3:32 AM EDT
you have to import the namespace where your class present.
like this
ex:
<%@ Import Namespace="System.IO" %>
change it to your class namespace