Check once per user session - asp.net
I would like to make a call to the underlying backend just one time when user first initiates a user session. While the session is up, the same call shall never be made again. Do I just create a singleton tied to the particular session or is there 开发者_JAVA百科a better way to do this?
You can place the method call in the global.asax Session_Start event.
List of available events is listed here.
You can always use the Begin_Session Session_Start
method in the global.asax. This will fire only once and only at the beginning of the session. It will fire before any authentication occurs, though.
Edit: Begin_Session? Sorry. Code bleed in my brain. I've corrected the actual function name above. The bleed was for a proprietary project I had active in my noggin when I was reading the question.
精彩评论