<authentication mode="Forms">
<forms loginUrl="logon.aspx" name="adAuthName" timeout="60" path="/"> </forms>
</authentication>
My Web Application works Correctly but when i go to Login.aspx page this error comes on:
System.InvalidCastException: 'Unable to cast object of type 'System.Security.Principal.GenericIdentity' to type 'System.Web.Security.FormsIdentity'.'
Error Details :
System.InvalidCastException occurred
HResult=0x80004002
Message=Unable to cast object of type 'System.Security.Principal.GenericIdentity' to type 'System.Web.Security.FormsIdentity'.
Source=App_Web_dusai4r1
StackTrace:
at Account_Login.Page_Load(Object sender, EventArgs e) in C:\Users\d_rody\Desktop\BlueStone.1old\WebSites\BlueStone\Account\Login.aspx.cs:line 16
The code i am using :
FormsIdentity id = (FormsIdentity)User.Identity;
FormsAuthenticationTicket ticket = id.Ticket;
Response.Write("<p/>TicketName: " + ticket.Name);
Response.Write("<br/>Cookie Path: " + ticket.CookiePath);
Response.Write("<br/>Ticket Expiration: " +
ticket.Expiration.ToString());
Response.Write("<br/>Expired: " + ticket.Expired.ToString());
Response.Write("<br/>Persistent: " + ticket.IsPersistent.ToString());
Response.Write("<br/>IssueDate: " + ticket.IssueDate.ToString());
Response.Write("<br/>UserData: " + ticket.UserData);
Response.Write("<br/>Version: " + ticket.Version.ToString());
Also I am not a .Net expert, so any help will be greatly appreciated.