Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. How to autorun a function in asp.net?

How to autorun a function in asp.net?

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netsysadminhelptutorial
8 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    ngoanrazor
    wrote on last edited by
    #1

    I want autorun a function (ex: send mail every day,...) in my web ASP.NET but dont use Windows Service. Server Asp allway auto. Please help me! Thank you read!

    N J 2 Replies Last reply
    0
    • N ngoanrazor

      I want autorun a function (ex: send mail every day,...) in my web ASP.NET but dont use Windows Service. Server Asp allway auto. Please help me! Thank you read!

      N Offline
      N Offline
      N a v a n e e t h
      wrote on last edited by
      #2

      ngoanrazor wrote:

      I want autorun a function (ex: send mail every day,...) in my web ASP.NET but dont use Windows Service

      You can write a simple console application which send the mail. Schedule this application using Windows scheduler.

      Best wishes, Navaneeth

      N 1 Reply Last reply
      0
      • N N a v a n e e t h

        ngoanrazor wrote:

        I want autorun a function (ex: send mail every day,...) in my web ASP.NET but dont use Windows Service

        You can write a simple console application which send the mail. Schedule this application using Windows scheduler.

        Best wishes, Navaneeth

        N Offline
        N Offline
        ngoanrazor
        wrote on last edited by
        #3

        Thank you reply! :) I dont want use Windows scheduler. Is it possible when use ASP to autorun?

        A N 2 Replies Last reply
        0
        • N ngoanrazor

          Thank you reply! :) I dont want use Windows scheduler. Is it possible when use ASP to autorun?

          A Offline
          A Offline
          Ali Al Omairi Abu AlHassan
          wrote on last edited by
          #4

          Sir; ASP.NET works under IIS which is a web server that recieve http requests and send http reponses but it can't run periodic tasks.

          Help people,so poeple can help you.

          1 Reply Last reply
          0
          • N ngoanrazor

            I want autorun a function (ex: send mail every day,...) in my web ASP.NET but dont use Windows Service. Server Asp allway auto. Please help me! Thank you read!

            J Offline
            J Offline
            jc net
            wrote on last edited by
            #5

            Well there is a technique using cache object expiration where you can get a function of your own to run, search on google for: asp.net cache scheduled task and you can find working code. Good luck. /jc

            N 1 Reply Last reply
            0
            • N ngoanrazor

              Thank you reply! :) I dont want use Windows scheduler. Is it possible when use ASP to autorun?

              N Offline
              N Offline
              N a v a n e e t h
              wrote on last edited by
              #6

              ngoanrazor wrote:

              Is it possible when use ASP to autorun?

              You could hack it up. But it won't be stable and not recommended for a production system. To do that, start a thread which loops on an infinite loop.

              while(true)
              {
              // process
              Thread.Sleep(someTime);
              }

              This will work but when IIS recycles the ASP.NET process, it will kill this thread. Like I said before, this is not stable. :)

              Best wishes, Navaneeth

              N 1 Reply Last reply
              0
              • N N a v a n e e t h

                ngoanrazor wrote:

                Is it possible when use ASP to autorun?

                You could hack it up. But it won't be stable and not recommended for a production system. To do that, start a thread which loops on an infinite loop.

                while(true)
                {
                // process
                Thread.Sleep(someTime);
                }

                This will work but when IIS recycles the ASP.NET process, it will kill this thread. Like I said before, this is not stable. :)

                Best wishes, Navaneeth

                N Offline
                N Offline
                ngoanrazor
                wrote on last edited by
                #7

                thank you :)

                1 Reply Last reply
                0
                • J jc net

                  Well there is a technique using cache object expiration where you can get a function of your own to run, search on google for: asp.net cache scheduled task and you can find working code. Good luck. /jc

                  N Offline
                  N Offline
                  ngoanrazor
                  wrote on last edited by
                  #8

                  Thank you, I will try :)

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups