Global.asax Application_End questions

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Global.asax Application_End questions

    My .Net book states that the Application_End event handler in Global.asax
    gets called typically about 20 minutes after the last HTTP request. My
    question is: what is the best way to debug my Application_End code? I could
    of course add a button or something to a form to run the code explicitly,
    but I want to be sure it is really getting called after 20 minutes. I assume
    that if I put a breakpoint in my Application_End code, and then run the
    application from within VS.Net, that 20 minutes later my breakpoint isn't
    going to get hit and suddenly I can step through it. Lastly, what the code
    does is update the database with the current application cache, and I want
    this to happen right afdter I exit the application, not 20 minutes later,
    while I'm developing the app, I'm going in and out all the time and 20
    minutes won't pass without an HTTP request pretty much all day.

    How is this stuff typically handled?

    --
    - Jim Owen
    206-501-6936


    Jim Owen Guest

  2. Similar Questions and Discussions

    1. global.asax
      Hi all! I've created a simple aspx application and when I run it locally on my pc all works fine. If I move it on the web server I get the...
    2. Name of events in Global.asax
      Hi. Reading the docs about the Global.asax events I noticed the names used on the help are not the same on the file. For example, the docs talk...
    3. Global Error handling in Applicatio_Error() of Global.asax
      Hi all, For a web application if we are using web farm, and if i want to do Global Error handling can i use Applicatio_Error() method in...
    4. What is Global.asax?
      It's the class file definition code for the Session and Application events - if you have anything that should be done when a user first connects or...
    5. Global ASAX error
      Sounds like references have been removed from your web.config file. Look in your web.config file under...
  3. #2

    Default Global.asax Application_End questions

    that's the nature of the beast... you don't know when the
    application will end.

    You said "when I exit the application" - that event
    doesn't happen. you close the browser, but you
    don't "Exit" a web application... not unless you have a
    button that says "Exit Application" - and of course,
    that's silly.

    You can either sit in the debugger, waiting for the app to
    die, add a button to simulate the event, or just add a
    button that calls your end-of-application routines to test
    it, then implement the code and all should be A-ok

    >-----Original Message-----
    >My .Net book states that the Application_End event
    handler in Global.asax
    >gets called typically about 20 minutes after the last
    HTTP request. My
    >question is: what is the best way to debug my
    Application_End code? I could
    >of course add a button or something to a form to run the
    code explicitly,
    >but I want to be sure it is really getting called after
    20 minutes. I assume
    >that if I put a breakpoint in my Application_End code,
    and then run the
    >application from within VS.Net, that 20 minutes later my
    breakpoint isn't
    >going to get hit and suddenly I can step through it.
    Lastly, what the code
    >does is update the database with the current application
    cache, and I want
    >this to happen right afdter I exit the application, not
    20 minutes later,
    >while I'm developing the app, I'm going in and out all
    the time and 20
    >minutes won't pass without an HTTP request pretty much
    all day.
    >
    >How is this stuff typically handled?
    >
    >--
    >- Jim Owen
    >206-501-6936
    >
    >
    >.
    >
    David Waz.. Guest

  4. #3

    Default Re: Global.asax Application_End questions

    You want the Session_End event, not the Application_End event. The
    Session_End Event occurs whenever a single user Session ends. As you pointed
    out, in a web site with many users accessing it every day, the
    Application_End Event may never fire. In either case you're going to have to
    wait. There's no way to force it from the browser side. If the user
    navigates away, or closes their browser, the server has no way of knowing
    this (HTTP is stateless). When the Session times out, the event will fire.

    HTH,

    Kevin Spencer
    Microsoft FrontPage MVP
    Internet Developer
    [url]http://www.takempis.com[/url]
    Some things just happen.
    Everything else occurs.

    "Jim Owen" <jkoseattle@comcast.net> wrote in message
    news:epjXzXZQDHA.2424@tk2msftngp13.phx.gbl...
    > My .Net book states that the Application_End event handler in Global.asax
    > gets called typically about 20 minutes after the last HTTP request. My
    > question is: what is the best way to debug my Application_End code? I
    could
    > of course add a button or something to a form to run the code explicitly,
    > but I want to be sure it is really getting called after 20 minutes. I
    assume
    > that if I put a breakpoint in my Application_End code, and then run the
    > application from within VS.Net, that 20 minutes later my breakpoint isn't
    > going to get hit and suddenly I can step through it. Lastly, what the code
    > does is update the database with the current application cache, and I want
    > this to happen right afdter I exit the application, not 20 minutes later,
    > while I'm developing the app, I'm going in and out all the time and 20
    > minutes won't pass without an HTTP request pretty much all day.
    >
    > How is this stuff typically handled?
    >
    > --
    > - Jim Owen
    > 206-501-6936
    >
    >

    Kevin Spencer Guest

  5. #4

    Default Re: Global.asax Application_End questions

    Well now I'm quite confused. I have been able to debug my Application_End
    code and it works fine. Then just for grins I put a breakpoint in there and
    let the browser sit there while I ate lunch, and it never hit my
    Application_End code. What am I doing wrong? All I've done is put a call to
    a method in the Global.asax file under Application_End.

    --
    - Jim Owen
    206-501-6936
    "David Waz.." <dlw@pickpro.com> wrote in message
    news:531701c34197$7a4b7ae0$a401280a@phx.gbl...
    > that's the nature of the beast... you don't know when the
    > application will end.
    >
    > You said "when I exit the application" - that event
    > doesn't happen. you close the browser, but you
    > don't "Exit" a web application... not unless you have a
    > button that says "Exit Application" - and of course,
    > that's silly.
    >
    > You can either sit in the debugger, waiting for the app to
    > die, add a button to simulate the event, or just add a
    > button that calls your end-of-application routines to test
    > it, then implement the code and all should be A-ok
    >
    >
    > >-----Original Message-----
    > >My .Net book states that the Application_End event
    > handler in Global.asax
    > >gets called typically about 20 minutes after the last
    > HTTP request. My
    > >question is: what is the best way to debug my
    > Application_End code? I could
    > >of course add a button or something to a form to run the
    > code explicitly,
    > >but I want to be sure it is really getting called after
    > 20 minutes. I assume
    > >that if I put a breakpoint in my Application_End code,
    > and then run the
    > >application from within VS.Net, that 20 minutes later my
    > breakpoint isn't
    > >going to get hit and suddenly I can step through it.
    > Lastly, what the code
    > >does is update the database with the current application
    > cache, and I want
    > >this to happen right afdter I exit the application, not
    > 20 minutes later,
    > >while I'm developing the app, I'm going in and out all
    > the time and 20
    > >minutes won't pass without an HTTP request pretty much
    > all day.
    > >
    > >How is this stuff typically handled?
    > >
    > >--
    > >- Jim Owen
    > >206-501-6936
    > >
    > >
    > >.
    > >

    Jim Owen Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139