473,663 Members | 2,705 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Network login and e-mail address

I've been mucking about with Environment.Use rName 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 2043
You can use Environment.Use rDomainName if the application is WinForms one
and HttpContext.Cur rent.User.Ident ity.Name if you are in the ASP.NET
application.

Once you've obtained the domain name
System.Director yServices 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*******@cana da.com> wrote in message
news:11******** **************@ g14g2000cwa.goo glegroups.com.. .
I've been mucking about with Environment.Use rName 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.Use rName and Environment.Use rDomainName, 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*******@cana da.com> wrote in message
news:11******** **************@ g14g2000cwa.goo glegroups.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.Use rName and Environment.Use rDomainName, 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
7209
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'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details:...
5
5949
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 helpful
0
1077
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 transfer to get access to the database. The only problem I can see myself having while coding this is that the current asp page requires a network login (a network login prompt shows up when the users access the page). How can I do this in C# windows...
1
648
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 error appeared. Server Error in '/WebApplication1' Application. Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.
5
3104
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 impersonate a user and obtain network credentials using the DuplicateTokenEx call with appropriate parameters even though the call seems to not fail. I check my identity has changed but can only still do local commands. I would consider...
5
1528
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" ..... /> in machine.config) The connection string is "packet size=4096;Integrated Security=SSPI;data source=(local); persist security info=False;initial catalog=mydb"
3
2091
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 automatically log them in. If they don't they wil be taken to the login page. I can get the network id of the user using System.Environment.UserName if I turn off anonymous access but this gived me an access denied error. If I turn on...
3
3592
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 modified. I haven't implemented Access security, and want their Network Login ID. The network is running W2K server and all users have unique login ID's. I run A2K and I've found Dev Ashish's code at http://www.mvps.org/access/api/api0008.htm . I...
3
4138
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. However, when I attempt to follow the same steps on the remote test server (a website I access via filesystem security accross my lan ).. I get the following when I attempt to select the security tab from the administer selection of the login...
2
1222
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 redirectiopn into the login page and than the proper web service is open. My question is how can I configure the network or code the client to use the web service. (This server is open for users without logging in but there is still redirection). When I'm...
0
8345
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8547
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8633
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6186
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5655
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4181
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2763
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1999
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1754
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.