Share via

SharePoint Server Subscription Edition: base64 related exception thrown after the user session expires

Sergiu 41 Reputation points
2024-10-08T07:19:53.2766667+00:00

On SharePoint Server Subscription Edition, after the user session expires, on the first access to a site, the server responds with an error like below:

(I am able to make the exception go away by deleting the FedAuth1 cookie, but the error reappears next day at the first access to the site)


The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.

__Description:__An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. __Exception Details:__System.FormatException: The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters. Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.Stack Trace:

|[FormatException: The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters. ]
System.Convert.FromBase64_ComputeResultLength(Char* inputPtr, Int32 inputLength) +175
System.Convert.FromBase64CharPtr(Char* inputPtr, Int32 inputLength) +70
System.Convert.FromBase64String(String s) +45
Microsoft.SharePoint.IdentityModel.SPChunkedCookieHandlerV2.ReadCore(String name, HttpContext context) +226
System.IdentityModel.Services.SessionAuthenticationModule.TryReadSessionTokenFromCookie(SessionSecurityToken& sessionToken) +271
System.IdentityModel.Services.SessionAuthenticationModule.OnAuthenticateRequest(Object sender, EventArgs eventArgs) +243
Microsoft.SharePoint.IdentityModel.SPSessionAuthenticationModuleV2.OnAuthenticateRequest(Object sender, EventArgs eventArgs) +415
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +209
System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +182
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +94| | -------- | |[FormatException: The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters. ] System.Convert.FromBase64_ComputeResultLength(Char* inputPtr, Int32 inputLength) +175 System.Convert.FromBase64CharPtr(Char* inputPtr, Int32 inputLength) +70 System.Convert.FromBase64String(String s) +45 Microsoft.SharePoint.IdentityModel.SPChunkedCookieHandlerV2.ReadCore(String name, HttpContext context) +226 System.IdentityModel.Services.SessionAuthenticationModule.TryReadSessionTokenFromCookie(SessionSecurityToken& sessionToken) +271 System.IdentityModel.Services.SessionAuthenticationModule.OnAuthenticateRequest(Object sender, EventArgs eventArgs) +243 Microsoft.SharePoint.IdentityModel.SPSessionAuthenticationModuleV2.OnAuthenticateRequest(Object sender, EventArgs eventArgs) +415 System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +209 System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +182 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +94|


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.9266.0

Microsoft 365 and Office | SharePoint Server | For business
Microsoft 365 and Office | SharePoint | For business | Windows
0 comments No comments

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 40,496 Reputation points Microsoft External Staff
    2024-10-08T08:39:29.36+00:00

    Hi @Sergiu,

    As the error message shows your encode is not properly. You could refer to the following issue similar with yours

    https://stackoverflow.com/questions/77149301/the-input-is-not-a-valid-base-64-string-how-to-solve

    And you can use following code to read it into a byte array

    var bytearray = new Guid("59216167-f9c0-4b1b-b1db-1babd1209f10").ToByteArray();
    
    
    

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.