Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Apr 12, 2012 07:32 AM by ciupazMI
Apr 12, 2012 06:52 AM|LINK
I'm trying a simple home.aspx page in my web application in this way:
protected void Page_Load(object sender, EventArgs e)
var user = Membership.GetUser();
if (user != null)
userName.Text = user.UserName;
emailAddress.Text = user.Email;
if (user is ActiveDirectoryMembershipUser)
lastLoginDate.Text = "Not available";
lastActivityDate.Text = "Not available";
lastLoginDate.Text = user.LastLoginDate.ToShortDateString();
lastActivityDate.Text = user.LastActivityDate.ToShortDateString();
var sidValue = (System.Security.Principal.SecurityIdentifier)user.ProviderUserKey;
if (sidValue != null)
sid.Text = sidValue.ToString();
to get user information from Active Directory authentication:
My scope is to know the user in my web app without force users to insert username/password, but just only using his A.D. login in the firm intranet.
The problem is that does not work in this way, because I got user = null.
What's wrong in my approach?
Thanks in advance.
Apr 12, 2012 07:06 AM|LINK
Integrated Windows Authentication must be turned on in IIS for this to work.
Apr 12, 2012 07:32 AM|LINK
So I have to deploy in IIS my test web application?