Tracking who is on the page (via Active Directory username)

Last post 06-17-2009 11:24 AM by danevansjr. 4 replies.

Sort Posts:

  • Tracking who is on the page (via Active Directory username)

    06-16-2009, 10:40 AM

    Hey everyone -- sorry for the stupid question:

    I'm currently writing my web application in an ASP.net, version 2.0 / vb.net backend envrionment.  Its a small Purchase Requisition application for the company that I work for and here's what I'm having an issue with. 

    I'm attempting to keep track of who's making changes to the records throughout the application using windows authentication.  Just so I'm being clear:

    Say my Active Directory account was username: rboyle

    I would want to know when I Inserted / Updated / Deleted a record on Page1 of the application that Username: rboyle   did this. 

    I'm not to familiar with linking vb.net applications to a domain network and pulling information out of it.   If someone has any examples on how to do this in a 2.0 environment, in vb.net I would love to see it.

    Thanks in advance everyone -- I appriciate the help in advance.

    Ryan

     

  • Re: Tracking who is on the page (via Active Directory username)

    06-16-2009, 11:51 AM
    • Contributor
      5,138 point Contributor
    • papabear
    • Member since 08-08-2005, 3:49 PM
    • Posts 851

    Take a looksee here to find out more re Windows Authentication in 2.0 -> http://msdn.microsoft.com/en-us/library/ms998358.aspx

    Have fun!

    m

    give me suggestions for what to blog... http://www.myfriedmind.com/techblog -> thx

    Mark as "Answered" if this solves that wee old problem...
  • Re: Tracking who is on the page (via Active Directory username)

    06-17-2009, 10:43 AM
    Answer
    • Member
      90 point Member
    • danevansjr
    • Member since 03-30-2009, 9:30 AM
    • Nashville, TN, USA
    • Posts 15

    Found it and solved my own issue.  I'm basically trying to get the current user(already verified with Active Directory), and throw that ID into an audit table whenever the user confirms a table change.  I knew it was simple, I just wasn't able to find the answer until now.

    // declare the variable
    String userName;

    // then later you can assign the current identity to it.
    userName = HttpContext.Current.User.Identity.Name.ToString();

     

    From there you can do whatever you want with it.  Store it to a session variable, stick it in a table, print it on a report, etc.
     

  • Re: Tracking who is on the page (via Active Directory username)

    06-17-2009, 11:19 AM

    danevansjr: Thanks a lot for your info - much apprciated.

     One last thing -

    To use the HttpContext.Current.User.Identity.Name.ToString() what class do I need to import into the beginning of my code on each page.

    Thanks again everyone - I'll give points in a couple min.

     Thanks again!!

    Ryan

  • Re: Tracking who is on the page (via Active Directory username)

    06-17-2009, 11:24 AM
    Answer
    • Member
      90 point Member
    • danevansjr
    • Member since 03-30-2009, 9:30 AM
    • Nashville, TN, USA
    • Posts 15

    using System.Web;

     

    Hope that helps.  It's doing the trick for me.

Page 1 of 1 (5 items)