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.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sanjeeb LenkaPosted Jul 16, 2013, 7:32 AM
you have to import the namespace where your class present.
like this
ex:
<%@ Import Namespace="System.IO" %>
change it to your class namespace
manjula dPosted Jul 16, 2013, 7:17 AM
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?)
Iftikar HussainPosted Jul 16, 2013, 6:41 AM
You can do like this
If your class in different project, then include the namespace by using
Regards,
Iftikar
manjula dPosted Jul 16, 2013, 6:26 AM
Pankaj PandeyPosted Jul 16, 2013, 6:19 AM
http://forums.asp.net/t/1563699.aspx
http://quickstarts.asp.net/QuickStartv20/aspnet/doc/applications/globalasax.aspx
Sanjeeb LenkaPosted Jul 16, 2013, 6:12 AM
http://stackoverflow.com/questions/16319154/call-function-in-aspx-cs-page-from-global-asax