computer username display

  • Thread starter jason via DotNetMonster.com
  • 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..
 
A

Aaron Corcoran

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
 
J

\jason via DotNetMonster.com\

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

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top