Corey Burnett
Corey Burnett

Reputation: 7340

Is it possible to get access to the HTTP Context from within a Sitecore Event handler?

I am building a custom event handler for the Sitecore security:loggedin event. Basically I want to run some code every time a user logs in. Is it possible for me to get access to the HttpContext (application level variables, etc) from within the event handler code? From what I can tell the only argument that is passed in is the User object for the user that just logged in.

Thanks, Corey

Upvotes: 0

Views: 992

Answers (1)

Bryan
Bryan

Reputation: 8778

Yes, this is entirely possible:

if (System.Web.HttpContext.Current != null)
{
    //do what you like
}

Upvotes: 2

Related Questions