q: user e-mail

Discussion in 'ASP .Net' started by =?Utf-8?B?SklNLkgu?=, Jan 19, 2005.

  1. Hello,
    User.Identity.Name gives me current user name, how can I get the e-mail
    address of current user?
    Jim.
     
    =?Utf-8?B?SklNLkgu?=, Jan 19, 2005
    #1
    1. Advertising

  2. Re: user e-mail

    Unless you're using Windows Authentication and Active Directory in an
    Intranet environment, there is no way to get the user's email address except
    asking them for it.

    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP
    http://SteveOrr.net


    "JIM.H." <> wrote in message
    news:...
    > Hello,
    > User.Identity.Name gives me current user name, how can I get the e-mail
    > address of current user?
    > Jim.
    >
     
    Steve C. Orr [MVP, MCSD], Jan 19, 2005
    #2
    1. Advertising

  3. Re: user e-mail

    If you are in that environment as Steve adviced then you should be able
    to retrieve the email addy!
    Patrick


    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Patrick Olurotimi Ige, Jan 19, 2005
    #3
  4. Re: user e-mail

    Application is fro intranet. If I am able to get current user with
    User.Identity.Name, doen't that mean I am using Windows Authentication? If
    not, what shoudl I do and how should I retreive e-mail from AD?


    "Patrick Olurotimi Ige" wrote:

    > If you are in that environment as Steve adviced then you should be able
    > to retrieve the email addy!
    > Patrick
    >
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!
    >
     
    =?Utf-8?B?SklNLkgu?=, Jan 19, 2005
    #4
  5. Re: user e-mail

    This code should get you the user's full name.
    With a little tinkering I bet you can also get the email address.
    (also set <identity impersonate="true"/> in your web.config)


    string Domain_Slash_User = Context.User.Identity.Name;


    Domain_Slash_Machine = Domain_Slash_Machine.Replace(@"\", @"/");string
    queryString = @"WinNT://" + Domain_Slash_Machine;DirectoryEntry obDirEntry =
    new DirectoryEntry(queryString);
    System.DirectoryServices.PropertyCollection coll = obDirEntry.Properties;



    object obVal = coll["FullName"].Value;_User = obVal.ToString();

    Session.Add("UserFullName", _User);

    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP
    http://SteveOrr.net



    "JIM.H." <> wrote in message
    news:...
    > Application is fro intranet. If I am able to get current user with
    > User.Identity.Name, doen't that mean I am using Windows Authentication? If
    > not, what shoudl I do and how should I retreive e-mail from AD?
    >
    >
    > "Patrick Olurotimi Ige" wrote:
    >
    >> If you are in that environment as Steve adviced then you should be able
    >> to retrieve the email addy!
    >> Patrick
    >>
    >>
    >> *** Sent via Developersdex http://www.developersdex.com ***
    >> Don't just participate in USENET...get rewarded for it!
    >>
     
    Steve C. Orr [MVP, MCSD], Jan 20, 2005
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Curt_C [MVP]
    Replies:
    5
    Views:
    392
    Karim
    May 19, 2004
  2. me
    Replies:
    0
    Views:
    476
  3. =?Utf-8?B?TXJGZXo=?=

    Mail message size problem (System.Web.Mail)

    =?Utf-8?B?TXJGZXo=?=, Mar 14, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    649
    =?Utf-8?B?TXJGZXo=?=
    Mar 14, 2005
  4. =?Utf-8?B?TWlja2VCb3k=?=

    Problem with System.Web.Mail.MailMessage and HTML mail

    =?Utf-8?B?TWlja2VCb3k=?=, Jun 15, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    927
    =?Utf-8?B?TWlja2VCb3k=?=
    Jun 21, 2005
  5. John Dalberg
    Replies:
    1
    Views:
    2,653
    =?Utf-8?B?U2l2YSBN?=
    Sep 19, 2005
Loading...

Share This Page