Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6575323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:22:22+00:00 2026-05-25T15:22:22+00:00

I am a newbie, but I am unable to get this code working. FileSweeper

  • 0

I am a newbie, but I am unable to get this code working. FileSweeper is supposed to start a timmer that triggers fileCopy on a web server. fileSweeoer is triggered by global.asax. FileCopy then will copy the file. However the FC.copy never fires. Any help/explanation would be helpful!

Would it make any difference if this was a class running on a web server?

My code is from http://msdn.microsoft.com/en-us/library/system.threading.timer.aspx.

Imports Microsoft.VisualBasic
Imports System
Imports System.Threading

Public Class fileSweeper

Dim stateTimer As Timer

<MTAThread()> _
Sub Main()
    Dim FC As New fileCopy
    Dim tcb As TimerCallback = AddressOf FC.Copy

    stateTimer = New Timer(tcb, "", 20000, 200000)
    GC.KeepAlive(stateTimer)
End Sub

End Class

Global.asax:

<%@ Application Language="VB" %>

<script runat="server">

Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)

End Sub

Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
    ' Code that runs on application shutdown
End Sub

Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
    ' Code that runs when an unhandled error occurs
End Sub

Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
    ' Code that runs when a new session is started
    Dim FS As New fileSweeper
    FS.Main()
End Sub

Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
    ' 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.
End Sub

</script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T15:22:22+00:00Added an answer on May 25, 2026 at 3:22 pm

    You are probably going to get unexpected results here because you are likely going to get multiple sessions on a web server. You might want to consider creating a console app and using windows task scheduler.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this is a bit of a newbie question but hoping I can get some
Im sure this is simple but newbie here. I have 5 URLS cards.php&type=one cards.php&type=two
I know this is probably a newbie questions but again, I'm fairly new to
Newbie question here but for some reason I cant figure this out. I have
I know I'm a newbie in Rails but this is the second day I'm
Sorry for the newbie question, but I can't seem to figure this out. I
Forgive me if this screams newbie but what does => mean in C#? I
This question will sound like a newbie but i have gone through all threads
I have read that CTE are better than cursor. But I am unable to
Total newbie question but this is driving me mad! I'm trying this: myInt =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.