Solved

ASP.net Event seems to fire non stop

Posted on 2013-11-14
2
448 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:Murray Brown
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 29

Accepted Solution

by:
Paul Jackson earned 500 total points
ID: 39648489
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:Murray Brown
ID: 39648495
Thanks very much
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

626 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