global.asax dosyasını oluşturdum ve anadizine attım, kodlar aşağıdaki gibi ama çalıştıramadım bir türlü, yanlışım nerde acaba?
<%@ Application Codebehind="Global.asax.cs" Inherits="WebApplication1.Global" Language="C#" %>
<%@ Application Language="C#" %>
<%@ Import Namespace="System.Timers" %>
<%@ Import Namespace="System.Net" %>
<%@ Import Namespace="System.Collections.Specialized" %>
<script runat="server">
void Application_Start(object sender, EventArgs e)
{
ZamanliGorevSinifi.ZamanliAlarmBaslat();
}
void Application_End(object sender, EventArgs e)
{
// Code that runs on application shutdown
}
void Application_Error(object sender, EventArgs e)
{
// Code that runs when an unhandled error occurs
}
void Session_Start(object sender, EventArgs e)
{
// Code that runs when a new session is started
}
void Session_End(object sender, EventArgs e)
{
// Code that runs when a session ends.
// Note: The Session_End event is raised only when the sessionstate mode
// is set to InProc in the Web.config file. If session mode is set to StateServer
// or SQLServer, the event is not raised.
}
public class ZamanliGorevSinifi
{
private static System.Timers.Timer _AlarmTimer;
public static void ZamanliAlarmBaslat()
{
//7200000 = 2 saat
//43200000 = 12 saat
//86400000 = 1 gün (24 saat)
_AlarmTimer = new System.Timers.Timer(30000);
_AlarmTimer.Elapsed += OnAlarmEvent;
_AlarmTimer.Enabled = true;
}
private static void OnAlarmEvent(object source, ElapsedEventArgs e)
{
System.Threading.Thread th = new System.Threading.Thread(AlarmSinifi.alarmKontrolve Gonderme);
th.IsBackground = true;
th.Start();
}
}
public class AlarmSinifi
{
public static void alarmKontrolveGonderme()
{
WebClient wc = new WebClient();
NameValueCollection col = new NameValueCollection();
col.Add("kullanici_adi", "yunusx.com");
byte[] sayfaBinary = wc.UploadValues("http://www.aaa.com/oto.asp", "POST", col);
string sayfa = System.Text.Encoding.UTF8.GetString(sayfaBinary);
}
}
</script>