Showing posts from November, 2012

Do Stuff Every Request

say i want to update the login table everytime the user makes any request

scenario 1: no webmethods or ajax:

from the great collection of events in Global Asax we have 3 that fires with each request And knows the Session:
voidSession_Start(object sender, EventArgs e){}
void Application_AcquireRequestState(object sender, EventArgs e){}
*here is ur code like pageload ect. btw
voidApplication_PostRequestHandlerExecute(object sender, EventArgs e){}

so in any of those i can put an sql query and use Session.SessionID or Session["myvar"]
NOTE! that since only PostRequest is executed after ur page finished his code that any changes made to the Session will only appear to him. Also in the very 1st run it will always be empty.

scenario 2: webmethods or ajax:

well i only tested that with page webmethods and PageMehtods, $.ajax and $.post client side.
i found out a few nice thing, fisrt of all from these 3 event only
Application_AcquireRequestState is fired.

on a side note i also found out…