Link to home
Start Free TrialLog in
Avatar of keithwilson1
keithwilson1Flag for United States of America

asked on

Correct Active Directory code to retrieve a key field

I am using VS2017 and trying to retrieve the username from the active directory of my school district.  Below is my syntax.

if (userName != " ")
            {
                KatyISD.Library.ActiveDirectory.User user = new KatyISD.Library.ActiveDirectory.User(userName);

                Response.Cookies.Add(new HttpCookie("KUId", user.Guid));
                Response.Cookies.Add(new HttpCookie("userNetworkID", user.UserName));
                Response.Cookies.Add(new HttpCookie("userName", user.LastName + ", " + user.FirstName));

                Response.Redirect("chooseDataSource.aspx");
            }

Is the code correct?
ASKER CERTIFIED SOLUTION
Avatar of Shaun Vermaak
Shaun Vermaak
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial