I'm trying to switch personalisation scope for the current user:
protected void lnkToggleMode_Click(object sender, EventArgs e)
{
try
{
var wpmgr = (SPWebPartManager)SPWebPartManager.GetCurrentWebPartManager(this.Page);
wpmgr.Personalization.ToggleScope();
}
catch (Exception)
{
throw;
}
}
However, the ToggleScope
method throws this exception:
'wpmgr.Personalization.ToggleScope()' threw an exception of type 'System.Threading.ThreadAbortException' base {System.SystemException}: {Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.} ExceptionState: Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.
Any thought?
FYI, the wpmgr.Personalization.CanEnterSharedScope
property is returning true