TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
I T
NA
8
8.3k
Unable to cast object 'System.Security.Principal.GenericIde'
May 2 2017 4:52 AM
I am trying to add AD Authentication to a existing Intranet Aplication
,
The Application uses Form Authentication
at the moment
.
<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.
Reply
Answers (
1
)
What book recommends to buy for 3-Tier Arch.
How to bind new line in multiline textbox asp.net c#?