473,387 Members | 1,536 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Network login and e-mail address

I've been mucking about with Environment.UserName and similar
properties in .NET. I can get the user's login name for their machine,
but unfortunately that doesn't get me much for users logged into our
corporate network through laptops: all its gets me is their user ID on
the laptop, which means nothing at the corporate level.

Does anyone know how I can get my hands on the username that was used
to log into Microsoft Networking? This is our corporate user name and
it's what I should be using to stamp record updates, etc.

As well, does anyone know how to get my hands on the user's default
e-mail address, the one that Outlook (et al) uses by default when you
send an e-mail message?

Nov 17 '05 #1
3 2027
You can use Environment.UserDomainName if the application is WinForms one
and HttpContext.Current.User.Identity.Name if you are in the ASP.NET
application.

Once you've obtained the domain name
System.DirectoryServices namespace will help you. It contains necessary
classess to query Active Directory for the info you need.
It uses LDAP pathes. Outlook Exchange server can also be queried in the same
way.
--
Vadym Stetsyak aka Vadmyst
http://vadmyst.blogspot.com
"Bruce Wood" <br*******@canada.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
I've been mucking about with Environment.UserName and similar
properties in .NET. I can get the user's login name for their machine,
but unfortunately that doesn't get me much for users logged into our
corporate network through laptops: all its gets me is their user ID on
the laptop, which means nothing at the corporate level.

Does anyone know how I can get my hands on the username that was used
to log into Microsoft Networking? This is our corporate user name and
it's what I should be using to stamp record updates, etc.

As well, does anyone know how to get my hands on the user's default
e-mail address, the one that Outlook (et al) uses by default when you
send an e-mail message?

Nov 17 '05 #2
After a bit more mucking around, I think I've figured out what I need:
I need the user's name in a particular domain.

The domain and domain user name on my laptop are pretty useless. The
important credentials are those with which I log onto the "CORP",
domain: our corporate domain.

If I query Environment.UserName and Environment.UserDomainName, I just
get domain "BRUCE", username "Bruce", which I know isn't right.
However, I also know that I have to login to domain "CORP" in order to
do anything useful on our network.

So, I don't want the _current_ user name and domain. I want whatever
user name was used to log onto domain "CORP". Is there any way to get
that in .NET? I took a tour around System.Security.Principal, but it
made my head hurt. :-)

Nov 17 '05 #3
You can look at DirectoryEntry constructor. It takes domain name, login
name, passwd and auth type parameters. After you've obtained the
DirectoryEntry - you have access to all the properties of Active Directory
account

--
Vadym Stetsyak aka Vadmyst
http://vadmyst.blogspot.com
"Bruce Wood" <br*******@canada.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
After a bit more mucking around, I think I've figured out what I need:
I need the user's name in a particular domain.

The domain and domain user name on my laptop are pretty useless. The
important credentials are those with which I log onto the "CORP",
domain: our corporate domain.

If I query Environment.UserName and Environment.UserDomainName, I just
get domain "BRUCE", username "Bruce", which I know isn't right.
However, I also know that I have to login to domain "CORP" in order to
do anything useful on our network.

So, I don't want the _current_ user name and domain. I want whatever
user name was used to log onto domain "CORP". Is there any way to get
that in .NET? I took a tour around System.Security.Principal, but it
made my head hurt. :-)

Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Stanley J, Mroczek | last post by:
My disk was replaced and i reload all my software. I think that i named my computer best-si-01 instead of BEST-SI-01 and thats my error? Login failed for user 'NT AUTHORITY\NETWORK SERVICE'....
5
by: owyn | last post by:
One of my coding partners swears you can capture the network login name so that we can use it to set security levels. If that can be done how do you do it. References to articles etc would be...
0
by: Benny Raymond | last post by:
I'm currently writing a time tracking app to replace the one we've had on our intranet for quite some time. I'd like to set this up to communicate with a server side asp page using xml data...
1
by: Ibrahim Mohamed El-Ganady | last post by:
Mr : I have proplem with Visual stdio 2003 and Windows2003 Enterprise Server , when I developed web application using ASP.Net (VB) that establish connection to SQL Server database the following...
5
by: Dave Kolb | last post by:
Is there any other solution for an ASPNET application to access network resources other than running as SYSTEM, using delegation (a nightmare to get to work) or the COM+ solution? I cannot seem to...
5
by: Martin | last post by:
Hi, Transferred a working ASP.Net app and database to a new machine and domain. The app should be running as the local aspnet account (<processModel userName="machine" password="AutoGenerate"...
3
by: Don | last post by:
I'm using FROMS authentication and want to automate the login. Right now I force the user to manually log in. I would like to detect the users network userName and if they have an account I will...
3
by: Tomdhu | last post by:
As a Newbie I've picked up a heap of tips and tricks from this NG but I have been battling to get the current user's Netwok Login ID recorded on a form at the time a new record is created or...
3
by: jason | last post by:
I've been playing around with new (for 2.0) membershp functionality. I was able to build a simple login form that secures a directory on a project I built locally on my development desktop. ...
2
by: =?Utf-8?B?bWFyZWs=?= | last post by:
Hi I have this problem. I want to use my web serivce in the wireless network where connection is open but users have to log into the network via the web browser to use it. So there is...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.