computer username display

Discussion in 'ASP .Net' started by jason via DotNetMonster.com, Jul 1, 2005.

  1. i am planning to add something that can capture the windows username in it
    and then i will save it to my database for further refference

    but how will the coding look like?
    i am new in asp.net so.. any idea?
    as far as i noe.. this line of code is to show the pc name right?
    Dim a As String = Environment.UserDomainName

    then how about showing the windows user name?

    ... Dim hostName As String = Dns.GetHostName()

    this one?
    but there is an error asking me to declare the dns..? waht should i declare?
    should this code works?
    thanks..
    jason via DotNetMonster.com, Jul 1, 2005
    #1
    1. Advertising

  2. Jason,

    If you want to capture the user that is currently logged into your
    application, assuming you are using Integrated Authentication, simply
    put the following line of code:

    Dim strUser As String =
    System.Security.Principal.WindowsIdentity.GetCurrent.Name.ToString()

    This code will reveal a string in the format of DOMAIN\username.

    I hope this helps!
    Aaron
    Aaron Corcoran, Jul 1, 2005
    #2
    1. Advertising

  3. yupe... i got another different code that helps.. thanks a lot..~ oh.. by the
    way.. do u noe how to send email in asp.net using vb.net? bust i don wish to
    add the coding in the htmlform... actually i got one that all the html coded
    inside.. but when i modify something..all the layout will be changed
    completely automatically.. i just need 2 textbox for the user to key in and
    then when he or she press the summit button, it will be sent to me... with
    all the data he or shse typed inside..

    thanks..`
    Aaron Corcoran wrote:
    >Jason,
    >
    >If you want to capture the user that is currently logged into your
    >application, assuming you are using Integrated Authentication, simply
    >put the following line of code:
    >
    >Dim strUser As String =
    >System.Security.Principal.WindowsIdentity.GetCurrent.Name.ToString()
    >
    >This code will reveal a string in the format of DOMAIN\username.
    >
    >I hope this helps!
    >Aaron



    --
    Message posted via DotNetMonster.com
    http://www.dotnetmonster.com/Uwe/Forums.aspx/asp-net/200507/1
    \jason via DotNetMonster.com\, Jul 6, 2005
    #3
  4. Aaron Corcoran, Jul 7, 2005
    #4
    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. A. M. G. Solo
    Replies:
    0
    Views:
    529
    A. M. G. Solo
    Jan 13, 2006
  2. EMW

    Username on client computer

    EMW, Jun 20, 2004, in forum: ASP .Net
    Replies:
    6
    Views:
    4,441
  3. Replies:
    3
    Views:
    458
    Marcus Kwok
    Mar 1, 2007
  4. Lionel Neo

    Display html on another computer instead of local computer

    Lionel Neo, Oct 11, 2004, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    222
    Robert Koritnik
    Oct 11, 2004
  5. Shailesh Patel
    Replies:
    0
    Views:
    439
    Shailesh Patel
    Nov 8, 2006
Loading...

Share This Page