We have a live running business system with an error which occurs from time to time. The error is according to the stack trace comming from the asp.net membership provider. It does not seem to matter which user is currently logged on. As far as i can tell the asp.net membership tables in the database are fine.
Example of a code row generating the error:
if (Membership.GetUser() != null)
Error description:
Unable to cast object of type 'System.Int32' to type 'System.String'.
Stack Trace:
[InvalidCastException: Unable to cast object of type 'System.Int32' to type 'System.String'.]
System.Data.SqlClient.SqlBuffer.get_String() +141
System.Data.SqlClient.SqlDataReader.GetString(Int32 i) +96
System.Web.Security.SqlMembershipProvider.GetNullableString(SqlDataReader reader, Int32 col) +35
System.Web.Security.SqlMembershipProvider.GetUser(String username, Boolean userIsOnline) +1110
System.Web.Security.Membership.GetUser(String username, Boolean userIsOnline) +82
System.Web.Security.Membership.GetUser() +19
Does anyone have an idea of what's wrong?
Update: We could not find a solution for this error. But eventually it disapeared.
Now when we migrated to another server this error totally cripples our application. I'm totally out of ideas :(