Sitecore 9 login: An Error Occurred, String or binary data would be truncated

This is caused by Sitecore generating a login ticket too long to be stored in the database, hence the data would be truncated. I'm not sure why this happens, but it looks like the URL (or part of the URL) is included in the ticket, causing it to be longer than the datatype in the database allows.

Here's the stacktrace from the log:

Nested Exception
Exception: System.Data.DataException
Message: Error executing SQL command: INSERT INTO [Properties] ( [Key], [Value] ) VALUES ( @name, @value )
Nested Exception
Exception: System.Data.SqlClient.SqlException
Message: String or binary data would be truncated.
The statement has been terminated.
Source: .Net SqlClient Data Provider

 

Solution

The solution is to delete the ticket directly in the core database, consequently forcing Sitecore to generate a new ticket upon next login. Run the following SQL query and make sure to target the impacted user by replacing "Username" with something uniquely identifying the user.

DELETE FROM [Project_Core].[dbo].[Properties]
WHERE [Project_Core].dbo.Properties.[Key] LIKE 'CORE_SC_TICKET%'
AND [Project_Core].dbo.Properties.[Value] LIKE '%Username%'

 

Comments (3) -

Add comment

Loading