Search code examples
sharepointsharepoint-2007mosswindows-sharepoint-services

Handling Session_Start and Session_End events - global.asax - SharePoint


I want to perform few tasks during Session_Start and Session_End (when user logs in and logs out) through custom code. Where should i write it? Is it possible by writing a code behind for global.asax? Will it break anything?

Thank you


Solution

  • You can write Inline code (aka old style ASP) in the global.asax solution of your project. You can then implement your custom code in Session_Start.

    You could also probably attempt do code behind, but the Global.Asax inherits from Microsoft.SharePoint.ApplicationRuntime.SPHttpApplication. You most likely need to override this DLL for it to work. Just guessing, have not tried.

    Just a FYI in case you have not done session in SharePoint previously. Out of the Box SharePoint does not support session. You need to take a couple of steps to enable it.

    John