Click here to Skip to main content
15,896,201 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
System.InvalidCastException on following line:

VB
If (System.Threading.Thread.CurrentPrincipal.Identity.IsAuthenticated = False) Then
        CType(System.Threading.Thread.CurrentPrincipal.Identity,
        System.Web.ClientServices.ClientFormsIdentity).RevalidateUser()
Posted
Updated 20-Jul-12 9:00am
v2
Comments
StianSandberg 20-Jul-12 9:11am    
looks like your System.Threading.Thread.CurrentPrincipal.Identity is null..
patelv61 20-Jul-12 10:04am    
Thank you very much.
BobJanova 20-Jul-12 12:21pm    
That's not C#, it's VB.

I believe you get this error:
Unable to cast object of type 'System.Security.Principal.GenericIdentity' to type 'System.Web.ClientServices.ClientFormsIdentity'

This will occur as long as you are not authenticated. To get the FormsIdentity you need to have been authenticated.
Refer: http://forums.asp.net/t/1114649.aspx/1[^]
 
Share this answer
 
The above issue will be
"Unable to cast object of type 'System.Security.Principal.GenericIdentity' to type 'System.Web.ClientServices.ClientFormsIdentity'."

The following thread will also be useful, Check this...
http://www.experts-exchange.com/Programming/Languages/C_Sharp/Q_22592880.html[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900