Security :: How To Get Email Address From AD
May 7, 2010
i have an aspx page which on page load needs to populate a text box with the current users email address (user is in Active Directory), any body know how to retrieve the email address from Active Directory, i have read this article on the web but am a bit confused
string userName = Environment.UserName;
string domainName = Environment.UserDomainName;
//Set the correct format for the AD query and filter
string ldapQueryFormat = @"LDAP://{0}.com/DC={0},DC=com";
string queryFilterFormat = @"(&(samAccountName={0})(objectCategory=person)(objectClass=user))";
SearchResult result = null;
using(DirectoryEntry root = newDirectoryEntry(rootQuery))
{
using(DirectorySearcher searcher = new DirectorySearcher(root))
{
searcher.Filter = searchFilter;
SearchResultCollection results = searcher.FindAll();
result = (results.Count != 0) ? results[0] : null;
}
}
string primaryEmail = result.Properties["mail"][0] as string;
There is no defintion of rootQuery- so not sure what that is, or a definition for searchFilter
View 1 Replies
Similar Messages:
Jan 31, 2011
how do I grab an email address from a web form and email to that email address with the link to a webform?
View 5 Replies
Oct 7, 2010
In my update Membership account routine, I have the sub:
[Code]....
This sub runs successfully and everything is updated, including the membership question and answer, except the membership.getuser.email address which is not updated.
View 1 Replies
Mar 18, 2011
I have a create user wizard on my page. Requires Security question hasbeen set to false. Once a new user is registered they can log in fine. If they forget their password, i have written code so that the user can enter the email address they used to register and a replacement is sent. The problem is I have written an application that is accessed by different people. So if the user that registered the account leaves the company
View 1 Replies
Oct 11, 2010
We are using Profile.FirstName and Profile.LastName to get current user's firstname/last name. How do we get current user's email address?
View 2 Replies
Jan 11, 2011
I am using .net membership, My question is how can i get a member email address by username?
View 1 Replies
Feb 15, 2010
How do I give user's the ability to sign in using either their username or email address? How do I implement profile URLS so that domain.com/username Server.Transfers to ViewProfile.aspx?userID=342 How do I implement a multi-domain auth system for a single web app so that users can create the same username at different domains?
View 1 Replies
Apr 16, 2010
When the member comes back to the site after verifingt the new email address, I need to check if he/she is logged on ( ie cookie is active) to the site for redirection. And If he/she is not logged on maybe log them on then redirect
View 1 Replies
Jan 12, 2010
I'm currently trying to figure out enabling my users, once logged in, to change their email address that they have registered. As far as I can see it's only held in the aspnet_Membership table.
The code I have so far is as follows, but it doesn't seem to be doing anything. No errors either so I can't go down that route yet!
[Code]....
I can't work out what's going wrong
View 3 Replies
Apr 3, 2010
I have been searching since some days for the best approach one can have in order to allow an authenticated user to change his/her email address.
This is the code I have but apparently it doesn't work and it doesnt even gives a error. The application seems to ignore it:
Change email address:
<asp:TextBox ID="txtEmail" runat="server"></asp:TextBox>
<asp:TextBox ID="txtPassword" runat="server"></asp:TextBox><br />
<asp:Button ID="changemailbtn" runat="server" Text="Button" />
<asp:Label ID="lblErrors" runat="server" EnableViewState="False"
[Code]....
View 8 Replies
Feb 5, 2010
I am unsure how to go about my task. I need to get the email property from asp.net's profile class.
I am loading a formview based on username stored in an sql table. I want to get the email address from the users profile based on the matching username fields
In pseudo code:
Get profile.emailaddress where username.text = profile.username
View 2 Replies
May 5, 2010
By default the Password Recovery control requires the username to send the user the login details. Is there any way I can configure it to work with either the log in name and email address or failing that just email address?
View 1 Replies
Jan 26, 2010
Is it possible to use the PasswordRecovery control to recover a password using the email address instead of the user name?
Ideally I'd like to have the PasswordRecovery control allow users to enter their email address instead of their user name and then proceed to answer the security question.
View 3 Replies
Feb 9, 2010
I program in vb
I was wondering if someone can direct me to a good quality tutorial on the process of registering and sending an activation link to the user's email address. I can't seem to find any useful tutorials online!
View 5 Replies
Oct 12, 2010
how to make login control allow users to login by either username or email address
View 1 Replies
Apr 11, 2010
I have a create user wizard on my page. Requires Security question hasbeen set to false.Once a new user is registered they can log in fine. If they forget their password, i have written code so that the user can enter the email address they used to register and a replacement is sent.The problem is I have written an application that is accessed by different people. So if the user that registered the account leaves the company
View 1 Replies
Jul 31, 2012
i want to add address book in email web application then how it will be possible???
View 1 Replies
Jun 29, 2010
I am building an email feature in my website (jobs site). By using this functionality, recruiters will be able to send emails to candidates. I want an option so that the user can also set 'From Address' and the email should be ANTI-SPAM compliant.
View 2 Replies
Jan 28, 2011
how do I grab an email address from a web form and email to that email address with the link to a webform?
View 2 Replies
Jun 17, 2012
i will enter an email address in textbox i have button on the click of button i would like to send a mail Hello to the mail address provider
View 1 Replies
May 7, 2015
In addition to the process of regex syntax validation of Email Addresses entered by users, I'm trying to check if the entered email address is a real one and does exist?The best I could achieve is to "Ping" the host the email address is associated with. But there are some other terms in the industry like Handshaking with Email Server, etc.not necessarily with 100% confirmation accurary!
View 1 Replies
May 7, 2015
How me can validate a email textbox to take only valid email address if error occur it show the error message in this textbox or as a tooltip. because in the form there is no space to show error message.
View 1 Replies
Mar 22, 2010
in my web i want to send email to distribution list instead of email addresthis is my code:
message.From = New MailAddress("Innovate_Web@KISR.EDU.KW")
message.To.Add(New MailAddress("mmahdi@safat.kisr.edu.kw"))
'message.To.Add(New MailAddress("innovate@safat.kisr.edu.kw"))
message.Subject = "Email from contact page in Innovate Web"
message.BodyEncoding = Encoding.UTF8
[code]...
View 5 Replies
Sep 20, 2012
These are sender settingcode in web.config
<configuration>
<appSettings>
<add key="Host" value="smtp.gmail.com"/>
<add key="EnableSsl" value="true"/>
<add key="UserName" value="neda@gmail.com"/>
<add key="Password" value="xxxx"/>
<add key="Port" value="587"/>
</appSettings>
<connectionStrings/>
here is sender email but i want there wasn't any email address.I mean i want when users click on button and send me an email there wasn't any email address in sender details.
View 1 Replies
Jul 10, 2010
i have a database query getting the email address of the user how can i put the email address of a user and code it here...
source code:
MailMessage msg = new MailMessage("usermail@abc.com", "#####@#####.com", "Mail Subject", "Mail Message");
View 2 Replies