Solved

ASP.net Event seems to fire non stop

Posted on 2013-11-14
2
438 Views
Last Modified: 2013-11-14
Hi. I ran the following code while debugging and then took it out but this event seems to be firing everytime I debug. Do I need to run code to stop this happening

Imports System.Web.SessionState
Imports System.Timers

Public Class Global_asax
    Inherits System.Web.HttpApplication

    Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
        ' Fires when the application is started
        ' Code that runs on application startup
        Dim myTimer As New System.Timers.Timer()
        ' Set the Interval to 5 seconds (5000 milliseconds).
        myTimer.Interval = 5000
        myTimer.AutoReset = True
        AddHandler myTimer.Elapsed, New ElapsedEventHandler(AddressOf myTimer_Elapsed)
        myTimer.Enabled = True
    End Sub
    Public Sub myTimer_Elapsed(source As Object, e As System.Timers.ElapsedEventArgs)
        ' use your mailer code
        Dim sBody As String = "From Great Site"
        Dim objScheduleMail As New clsScheduleMail()
        objScheduleMail.SendScheduleMail("info@online-excel.com", "info@online-excel.com", "murbro9@yahoo.com", "", "Excel-Online enquiry", sBody)
    End Sub
0
Comment
Question by:murbro
2 Comments
 
LVL 29

Accepted Solution

by:
Paul Jackson earned 500 total points
Comment Utility
No the Application_Start event will run every time you debug as essentially the application is starting for the first time when you debug. When deployed it will only run once when the application is started the first time a user requests a page.
0
 

Author Closing Comment

by:murbro
Comment Utility
Thanks very much
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now