17 thoughts on “Custom Sign In page for SharePoint 2010 (Claims authentication in Windows Authentication mode)

  1. Hi,
    I was trying this solution for SharePoint 2013. First i got the error ‘SessionSecurityToken’ is an ambiguous reference between ‘Microsoft.IdentityModel.Tokens.SessionSecurityToken’ and ‘System.IdentityModel.Tokens.SessionSecurityToken’. So i changed it to Microsoft.IdentityModel.Tokens.SessionSecurityToken. After deploying, i am getting error ambiguous reference error on following line.

    MethodInfo tryGetCachedToken = spTokenCache.GetMethod(“TryGetCachedToken”, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

    Can you please guide me removing these error and modify it for SharePoint 2013.

    Liked by 1 person

    • Hi,

      I stuck at same place when using this in SharePoint 2013

      MethodInfo tryGetCachedToken = spTokenCache.GetMethod(“TryGetCachedToken”, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

      Anyone has an idea how to resolve this issue?


    • try this:
      MethodInfo[] methods = spTokenCache.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
      MethodInfo tryGetCachedToken = methods[0];

      however, Type spWindowsClaimsAuthenticationHttpModule = sharePointIdentity.GetType(“Microsoft.SharePoint.IdentityModel.SPWindowsClaimsAuthenticationHttpModule”); is deprecated in sharepoint 2013, i will see if it can be replaced by a new version


  2. Hello Rizwan, Did you manage to solve the issue? I did not try this solution on SharePoint 2013 but this is something I want to do. If you still need help on this please let me know.


  3. Hi,
    I try to deploy your solution on my SharePoint 2010 but i can’t make it work.
    I have a simple WebApp with Claims enabled and NTLM Windows authentication only.

    I define the page “~/_layouts/SignInWithWindowsClaims/SignIn.aspx” as custom login page. But when i’m trying to sign, i always get back on the signin Page. The only change I made to your code was the redirection on Success :

    I try to debug the code and i dont see what is wrong : the method SignInUser goes to the final line of code and it returns true. I add some watches : both HttpContext.Current.User.Identity.Name and Page.User.Identity contain my Claims Identity at the end of the btnSignIn_Click. But when SharePoint brings me back to the SignIn Page, my identity is lost.

    Do you have any ideas on what can go wrong ?
    Thanks for your help !


  4. I am trying this in sp2013. The only issue i am facing is what Rizwan reported. If you have fixed this or any upcoming issue. kindly share your thaughts n code…


  5. Hello! I’ve been investigating how to make this code work on SP 2013. In my opinion it needs to be rewritten. MS changed a lot under the hood and it looks this code will not simply work after few modifications. The biggest problem is handling SessionSecurityToken. Event if some workaround will solve the issue now, it cannot be guaranteed that it will stay working after system or SharePoint security patches. Rewriting this will include some SharePoint reverse engineering. At the moment I’m not able to help with that. Hope that you guys have already solved this problems or used different solution.


  6. Hi

    Do we need .net framework 4.0 ? I m getting the below error.

    ‘SPSessionAuthenticationModule’ could not be found (are you missing a using directive or an assembly reference?



  7. Hello! You don’t need the .Net 4.0. Whole approach was based on SharePoint 2010 so the .Net 4.0 is not required here. SPSessionAuthenticationModule is in Microsoft.SharePoint.IdentityModel which should be in GAC.


  8. Hi Przemyslaw,

    I made it work on SP 2013 but it always prompt for ugly Internet Explorer login popup even though claims are validated. Do you have any idea on that? Claims are as follow. Thanks…

    SharePoint SharePoint http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier customer\srvc-spsetup-dev
    Windows SharePoint http://schemas.microsoft.com/ws/2008/06/identity/claims/primarysid S-1-5-21-505549280-1411234963-2092594028-6955
    Windows SharePoint http://schemas.microsoft.com/ws/2008/06/identity/claims/primarygroupsid S-1-5-21-505549280-1411234963-2092594028-513
    Windows SharePoint http://schemas.xmlsoap.org/ws/2005/05/identity/claims/denyonlysid S-1-5-32-544
    Windows SharePoint http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn srvc-spsetup-dev@customer.totalcom.net
    Windows SharePoint http://schemas.microsoft.com/sharepoint/2009/08/claims/userlogonname CUSTOMER\srvc-spsetup-dev
    SecurityTokenService SharePoint http://schemas.microsoft.com/sharepoint/2009/08/claims/userid 0#.w|customer\srvc-spsetup-dev
    SecurityTokenService SharePoint http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name 0#.w|customer\srvc-spsetup-dev
    SecurityTokenService SharePoint http://schemas.microsoft.com/sharepoint/2009/08/claims/identityprovider windows
    SecurityTokenService SharePoint http://schemas.microsoft.com/office/2012/01/nameidissuer urn:office:idp:activedirectory
    SecurityTokenService SharePoint http://sharepoint.microsoft.com/claims/2009/08/isauthenticated True
    ClaimProvider:System SharePoint http://schemas.microsoft.com/sharepoint/2009/08/claims/farmid e65bd570-460d-4201-8437-dc94f0b69f45
    SecurityTokenService SharePoint http://schemas.microsoft.com/office/2012/01/upn srvc-spsetup-dev@customer.totalcom.net
    SecurityTokenService SharePoint http://schemas.microsoft.com/office/2012/01/nameid s-1-5-21-505549280-1411234963-2092594028-6955
    SharePoint SharePoint http://sharepoint.microsoft.com/claims/2009/08/tokenreference 0).w|s-1-5-21-505549280-1411234963-2092594028-6955,0#.w|customer\srvc-spsetup-dev,131027354011222824,True,I/ho3nFjTZtSH7S4uueB8oZEhFDvDAkj+sJ+qjFzbZN5zN4vkbVAn/FTdRz/OWkVWujSmMhjIvyPHocvBM1H4hziVpVlMnFRhOWj4rQd1OBRvHkIi2QxSC4KgMNEWicTEMyUNxCzsn6uRMWRiPKYl075LTsK3daouOJkyMvfkcWH7Spnff96eJMFBKJGLKD+6WKVes1QKVC3UhkOS5DZInVpmKSj7HBhESN4phvihH9sWWdKWICm2M3Mi1nrV83culKEJmHzg+XZ6ZUUMrNOueecOpOJk1WPfqhaAlYXuWIbleOKYY393cZfYgOEFJUM8BmjVIqNUWrUBE0MTtGKqQ==,http://vncepdev1/_layouts/15/SigninWithWindowsClaims/Signin.aspx
    SecurityTokenService SharePoint http://sharepoint.microsoft.com/claims/2012/02/claimprovidercontext http://vncepdev1
    Windows SharePoint http://schemas.microsoft.com/ws/2008/06/identity/claims/groupsid S-1-5-21-505549280-1411234963-2092594028-513
    Windows SharePoint http://schemas.microsoft.com/ws/2008/06/identity/claims/groupsid S-1-1-0
    Windows SharePoint http://schemas.microsoft.com/ws/2008/06/identity/claims/groupsid S-1-5-21-2323408823-3989570887-3128594920-1009
    Windows SharePoint http://schemas.microsoft.com/ws/2008/06/identity/claims/groupsid S-1-5-21-2323408823-3989570887-3128594920-1010
    Windows SharePoint http://schemas.microsoft.com/ws/2008/06/identity/claims/groupsid S-1-5-21-2323408823-3989570887-3128594920-1011
    Windows SharePoint http://schemas.microsoft.com/ws/2008/06/identity/claims/groupsid S-1-5-11
    SharePoint SharePoint http://schemas.microsoft.com/ws/2008/06/identity/claims/authenticationmethod http://schemas.microsoft.com/ws/2008/06/identity/authenticationmethod/windows
    SharePoint SharePoint http://schemas.microsoft.com/ws/2008/06/identity/claims/authenticationinstant 2016-03-13T00:43:21.119Z


  9. Hey, I really appreciate your help , I’m grateful to you for , THANKS AND THANKS AND ….
    I research about 14 days and finally your code help me.
    I change it for sharepoint 2013 , Apparently some method is changed in reflection.invoke section.


  10. I’m getting parser error: …is not allowed here because it does not extend class ‘System.Web.UI.MasterPage’ on unsecured.master, does anyone have answer for this please ?


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s