locked
System.InvalidCastException: Unable to cast object of type 'System.Web.Security.FormsIdentity' to type 'CustomIdentity' RRS feed

  • Frage

  • I am getting the following exception in the application I am working on

    System.InvalidCastException: Unable to cast object of type 'System.Web.Security.FormsIdentity' to type 'CustomIdentity'

    I have checked for "IsAuthenticated" as follows

    if(HttpContext.Current.User.Identity.IsAuthenticated)

    {

    var identity=(CustomIdentity)HttpContext.Current.User.Identity.

    The exception is occurring inside the if block.

    Freitag, 4. Januar 2013 09:10