0

I have a HTTPHandler that won't deploy on a hosted version of SP 2010 as they only allow Sandbox code. Typically of course.

The handler simply checks for the SignOut.aspx page and does Session.Clear to more fully log users out.

Does anyone know of a way to run code like this in a Sandbox Solution? I can't use an Event Receiver as there isn't an event type for logging out.

Suggestions greatly appreciated.

Using VS 2010 & SharePoint Foundation 2010

Andrew Grothe
  • 2,562
  • 1
  • 32
  • 48

1 Answers1

1

Sandbox code is very restricted. The process that executes the logic does not even have HttpHandlers, and only a limited Request/Response.

I guess you could try:

  1. Create your own logout page in the site
  2. Add a control to your custom page to clear the session
  3. Replace the logout control in your master page, with a redirect to your own page
djeeg
  • 6,685
  • 3
  • 25
  • 28
  • Is perfect. At least now I can run some code. Getting invalid object reference on the HttpContext.Current but hopefully I can find away around that. – Andrew Grothe Jan 29 '11 at 20:11
  • Unfortunately it doesn't seem like the Session object is exposed to weparts/sandboxed code. :( – Andrew Grothe Jan 29 '11 at 20:58
  • @agrothe - make sure you have enabled session state in web parts on SP 2010, by default it is off. http://blogs.msdn.com/b/markarend/archive/2010/05/27/using-session-state-in-sharepoint-2010.aspx – Russell May 03 '11 at 04:36