473,385 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Try to get the user first name and last name form Active directory

Hi friends i am here again with my probelm. i have one login page when first login on the page it is checking the active directory user exist or not if user exist then go the next page all i nee to know how i can do when the user login it take you the next page i want to display user first anem in the txtbox and last name in the other text box so user not need to put his name please give me any idea or suggation how i can do that my cod eis like this
Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3.         private void cmdbutton_Click(object sender, System.EventArgs e)
  4.         {
  5.  
  6.  
  7.             string Path="LDAP://russwhitney.net";
  8.             bool bAuth = NETextensions.DirectoryServices.Credentials.AuthenticateUser(Path, txtLoginID.Text , txtPassword.Text);
  9.             if (bAuth)
  10.             {
  11.                 Session["Login"] = txtLoginID.Text;
  12.  
  13.                 string[] groups = NETextensions.DirectoryServices.Credentials.GetUserGroups(Path,txtLoginID.Text, txtPassword.Text);
  14.  
  15.                 if(groups.Length > 0)
  16.                 {
  17.                     for (int x=0; x< groups.Length;x++)
  18.                     {
  19.                         string group = groups[x].ToString();
  20.                         if (group == "*")
  21.                         {
  22.  
  23.                             Session["Login"] = true;
  24.                             return firstname;
  25.                             //break;
  26.  
  27.                             Session.Add("Login",txtLoginID.Text);
  28.  
  29.  
  30.  
  31.  
  32.                         }
  33.  
  34.  
  35.  
  36.                     }
  37.  
  38.         }
  39.                 Response.Redirect("Accomplishment.aspx");
  40.  
  41.             }
  42.  
  43.             else
  44.             {
  45.                 Session["Login"] = false;
  46.                 lblMessage.Text = "Login information is incorrect.";
  47.             }
  48.         }
  49.     }
  50. }
  51.  
  52.  
Oct 4 '07 #1
0 1447

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Leo_Surf | last post by:
Hello, I need your help adding user in Active Directory from ASP.net website. Could any one provide me the complete code for the html page. As this is my curriculam project and I dont have any...
3
by: Caspy | last post by:
I just get stuck on how to check if a user is a member of network (domain). I am building an internal tracking system with ASP.Net with Form authentication. When an user is added into the system,...
4
by: pjdouillard | last post by:
Hello all, Here is the context of my problem: We have an ASP.NET 1.1 application that has its own application pool setup and that runs under the identity of a NT Domain service account (this...
0
by: Kooki | last post by:
Hi, I am developing a small programme to add ACTIVE DIRECTORY users to another server. everything works fine .. I get the users from AD using LDAP but while adding users I need to get the user...
0
by: Kooki | last post by:
Hi, I am developing a small programme to add ACTIVE DIRECTORY users to another server. everything works fine .. I get the users from AD using LDAP but while adding users I need to get the user...
18
by: Arthur | last post by:
Hi All, I would like to get the name of the user given their networkID, is this something Active Directory would be useful for?(For intranet users) If so, can you please point me to some sample...
3
by: Terry Olsen | last post by:
I'm trying to add a domain user to a local group using the code below: Dim LCL As New DirectoryEntry("WinNT://" + Environment.MachineName + ",computer") Dim DOM As New...
1
maxamis4
by: maxamis4 | last post by:
Hello folks, Here is the backgroup. I am creating an agent that can find a user in LDAP and return the last logon date. Now i am not sure if with active directory you can user the...
1
by: Betray | last post by:
I recently changed 3 Users (login, first, last name, and job position) on our active directory. This was about a week ago.. they all can login fine, but when lets say the first user opens a file and...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.