computer username display

  • Thread starter Thread starter jason via DotNetMonster.com
  • Start date Start date
J

jason via DotNetMonster.com

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,

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
 
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..`
 
Back
Top