Viewflow Error: "Unable to cast object of type 'System.Web.Security.FormsIdentity' to type 'System.Security.Principal.WindowsIdentity"
KBS100119
PRODUCTIssue
The following error is displayed on the Viewflow page:
"Unable to cast object of type 'System.Web.Security.FormsIdentity' to type 'System.Security.Principal.WindowsIdentity'.
en SourceCode.Viewflow.SLViewer.ViewContainer.WebServiceSoapClient_GetDefaultViewTypeCompleted
(Object sender, GetDefaultViewTypeCompletedEventArgs e)
en SourceCode.Viewflow.SLViewer.VFService.WSViewFlowSoapClient.
OnGetDefaultViewTypeCompleted(Object state)"
- K2 Management Site
- K2 Designer Site
- K2 Runtime Site
- K2 Workspace (K2 Five and up)
Symptoms
The issue occurs when there is a misconfiguration of the Identity Claims: Windows Authentication is used instead of Forms Authentication.Troubleshooting Steps
- Make sure that the Authentication is set to Forms in IIS Manager:
IIS MANAGER > [K2 Site] > Viewflow > Authentication
Enable Forms & Anonymous authentication and disable Windows Authentication. Also ensure that Forms authentication login URL is set to '_trust/login.aspx'. This ensures that it redirects to Identity STS.
If the error occurs in a different site (e.g. Designer) make sure to change the authentication on that site
e.g. IIS MANAGER > [K2 Site] > Designer > Authentication
IIS Manager > K2 > Identity > Authentication
Enable Anonymous & Windows and disable Forms Authentication. - K2 Management > Authentication > Claims > Issuers.
Make sure that the 'Use For Login' is set to true for the correct STS (K2 Windows STS and/or K2 Forms STS). - K2 Management > Authentication > Claims > Claims.
Make sure that the 'Claim Type Info' is set to true for your Security Label (K2 if you are using K2 Windows STS or your Custom Security Label if you are using K2 Forms STS). - K2 Management > Authentication > Claims > Realms
Make sure your Realms are correct and that the correct Issuer is selected for your Realm. - Perform an IISRESET and Restart your K2 Server Service.
More on Multi-Authentication Providers: https://help.k2.com/onlinehelp/k2five/icg/5.3/default.htm#Configure/SF/K2MultiAuthIntroduction.htm
More on Standard SmartForms Authentication: https://help.k2.com/onlinehelp/k2five/icg/5.3/default.htm#Configure/SF/Authentication.htm