When a user is created in SharePoint 2013 (using forms based authentication) the UserToken is not set for the user.
When the users token then is accessed programmatically a "OutOfMemoryException" is thrown. In our case it happens when we try to use SPWeb.GetUserEffectivePermissions(loginName).
This happens until the user visits the site and tp_ExternalToken etc. is set.
The question is, how can I force SharePoint to do this before the first logon?
Relevant part of stack trace:
Type : System.OutOfMemoryException, mscorlib, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089
Message : Server Out Of Memory.
There is no memory on the server to run your program. Please contact your administrator with this problem.
Source :
Help link :
Data : System.Collections.ListDictionaryInternal
TargetSite : Byte[] GetUserToken(System.String, System.String)
HResult : -2147024882
Stack Trace :
at Microsoft.SharePoint.Library.SPRequestInternalClass.GetUserToken(String bstrUrl, String bstrLogin)
at Microsoft.SharePoint.Library.SPRequest.GetUserToken(String bstrUrl, String bstrLogin)
at Microsoft.SharePoint.Utilities.SPUtility.GetPermissions(String login, SPWeb web, SPSecurableObject securableObject, Boolean useCache)