This is a follow-on from an earlier question, I'm just feeling my way into querying AD from an asp.net c# web app:
In the code below I have a few lines that get the identity of the person logged in, I'd like to use this for my bool test so that I now look up the person logged in and confirm they exist in AD.
My plan is to then go on and retrieve certain details based on their identity:
Be grateful if someone could show me how to use my Session["username"] in the ("domain\\username") path, I have tried a few variations but clearly missing the obvious here.
protected void Page_Load(object sender, EventArgs e)
user = System.Web.HttpContext.Current.User;
identity = user.Identity;
Session["username"] = identity.Name.Substring(identity.Name.IndexOf(@"\") + 1);
bool test = IsExistInAD("domain\\username");
if (test == true)
Response.Write("user doesn't exist");