Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have written a custom SPClaimProvider for my SharePoint 2010 site. It seemed to be working for couple of days and it started throwing exception whenever I elevate the privileges or user Context Impersonation (using a Windows user). The exception details are below:

Source: Microsoft.SharePoint  Message: Operation is not valid due to the current state of the object.  Trace:   
 at Microsoft.SharePoint.SPUserToken.GetClaimsUserLoginName()    
 at Microsoft.SharePoint.SPSite.CopyUserToken(SPUserToken userToken)    
 at Microsoft.SharePoint.SPSite.SPSiteConstructor(SPFarm farm, Guid applicationId, Guid contentDatabaseId, Guid siteId, Guid siteSubscriptionId, SPUrlZone zone, Uri requestUri, String serverRelativeUrl, Boolean hostHeaderIsSiteName, SPUserToken userToken)    
 at Microsoft.SharePoint.SPSite..ctor(Guid id, SPFarm farm, SPUrlZone zone, SPUserToken userToken)    
 at Microsoft.SharePoint.SPSite..ctor(Guid id, SPUrlZone zone, SPUserToken userToken)    
 at Microsoft.SharePoint.SPSite..ctor(Guid id, SPUserToken userToken)    
 at IHI.Springs.GAC.Security.HttpContextImpersonation.ImpersonateSite()

Does anyone know what I am missing here?

share|improve this question
    
It seems GetClaimsUserLoginName() is a custom extension method. You should contact the author of that method. I will add that you cannot just create an SPUserToken with just a login name. You can save the token from a session where the user has logged in, or get a token for an IIdentity object. (And to get the IIdentity, you need a password...) –  Paul Schaeflein Feb 17 '12 at 17:36
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.