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

  • Question

  • 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.

    Friday, January 4, 2013 9:10 AM