You should create the SPWeb object within the Elevated privileges block, you shouldn't get the object from SPContext.
So, instead of this statement 'spWeb = SPContext.Current.Web' try to create a object
SPSite site = new SPSite();
SPWeb spWeb = site.OpenWeb();
and use this spWeb to call EnsureUser method.
Hope this should work.
So, instead of this statement 'spWeb = SPContext.Current.Web' try to create a object
SPSite site = new SPSite();
SPWeb spWeb = site.OpenWeb();
and use this spWeb to call EnsureUser method.
Hope this should work.
No comments:
Post a Comment