Viewflow Error: "Unable to cast object of type 'System.Web.Security.FormsIdentity' to type 'System.Security.Principal.WindowsIdentity"

  • 15 February 2022
  • 0 replies

Userlevel 5
Badge +20

Viewflow Error: "Unable to cast object of type 'System.Web.Security.FormsIdentity' to type 'System.Security.Principal.WindowsIdentity"


K2 Five
K2 blackpearl 4.7
K2 blackpearl 4.7
Security Provider
SmartForms Designer
This article was created in response to a support issue logged with K2. The content may include typographical errors and may be revised at any time without notice. This article is not considered official documentation for K2 software and is provided "as is" with no warranties.


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)"




This error can appear on the following sites:
  • K2 Management Site
  • K2 Designer Site
  • K2 Runtime Site
  • K2 Workspace (K2 Five and up)


The issue occurs when there is a misconfiguration of the Identity Claims: Windows Authentication is used instead of Forms Authentication.

Troubleshooting Steps

To resolve this issue:
  1. 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.
  2. 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).
  3. 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).
  4. K2 Management > Authentication > Claims > Realms
    Make sure your Realms are correct and that the correct Issuer is selected for your Realm.
  5. Perform an IISRESET and Restart your K2 Server Service.


More on Multi-Authentication Providers:

More on Standard SmartForms Authentication:


If you require any assistance to make sure that your Issuers / Claims and Realms are correct, please log a support ticket for hands on assistance.

0 replies

Be the first to reply!