User1457166430 posted
1 class CustomHTTPModule : HTTPModule
2 {
3 // We will skip the Init() and other event functions
4
5 private int _Count;
6
7 public void OnBeginRequest(object s, EventArgs e)
8 {
9 /* If the page that is loaded or refreshed is the one we want to "trigger" this module, Manipulate _Count in this code, most
10 likely just incrementing it until it is some finite
11 value, most likely using multi-threading.
12 */
13 }
14
15 public int GetCount()
16 {
17 return _Count;
18 }
19 }
My understanding is that OnBeginRequest will get executed when a specific page (as we've done here) is refreshed or loaded. If it's executed, say, when the page loads, we know that _Count gets incremented. From where do we or can we call this HttpModule's
GetCount() function? More specifically, we want to call this GetCount() function from JavaScript so that we can keep on calling it to allow us to display different _Count values. Is that even possible? What is the lifetime of _Count? Does it get reset when
I reload the page again?