Re: How to get user's full name using HttpContext.Current.User

Discussion in 'ASP .Net' started by Mike Newton, Jul 23, 2004.

  1. Mike Newton

    Mike Newton Guest

    Allen Davis wrote:
    > I have a need to store the full name of the current Active Directory user of my ASP.NET application when inserting and updating records in my SQL database. (IIS is using Windows auth only, the app is not impersonating and the ASPNET account is mirrored on the SQL server.) I haven't been able to find good source material for this yet. Can someone help point me in the right direction?
    >
    > I'm also hunting for good documentation about uploading and returning PDF documents from SQL through ASP.NET. Recommendations here would also be much appreciated.
    >
    > Thanks


    You can get the full name of the user from the AD, using LDAP, if the
    user name is stored in AD. Otherwise, you're just going to get the
    Login name.

    You probably want to use this http://support.microsoft.com/?kbid=221606
    as a resource for ldap searches. It's pretty easy to construct an
    application that lists all nodes in your LDAP (AD) directory.

    A typical search string that you'd want to use would look something like...

    (&(sAMAccountName=LOGONUSER)(objectClass=user))

    That would get you the AD node, then you just have to retrieve the name
    property.

    As for the uploading / returning PDF's, I would use byte arrays. You
    can use blob fields in SQL Server to store that stuff, but I prefer
    using the server's file system (you can easily access the files that
    way) and earmarking it with an ID that is assigned by the database.
     
    Mike Newton, Jul 23, 2004
    #1
    1. Advertisements

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. Dan Bart
    Replies:
    4
    Views:
    29,206
    Andrea D'Onofrio [MSFT]
    Dec 18, 2003
  2. Replies:
    10
    Views:
    3,673
    Kiran_S_Rao
    Dec 8, 2004
  3. =?Utf-8?B?dnZlbms=?=

    Help with HttpContext.Current.User.Identity.Name

    =?Utf-8?B?dnZlbms=?=, Sep 29, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    724
    Brock Allen
    Sep 29, 2005
  4. nalbayo
    Replies:
    2
    Views:
    5,871
    Bruce Barker
    Nov 11, 2005
  5. Abraham Andres Luna

    HttpContext.Current.User.Identity.Name

    Abraham Andres Luna, Oct 11, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    1,942
    Edwin Knoppert
    Oct 12, 2006
  6. Doogie
    Replies:
    4
    Views:
    972
    Doogie
    May 1, 2007
  7. Dan Bart

    Web.HttpContext.Current.User.Identity.Name is blank

    Dan Bart, Nov 20, 2003, in forum: ASP .Net Security
    Replies:
    4
    Views:
    787
    Andrea D'Onofrio [MSFT]
    Dec 18, 2003
  8. Tony

    Dim context As HttpContext = HttpContext.Current

    Tony, Mar 2, 2004, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    574
    Teemu Keiski
    Mar 3, 2004
Loading...