473,585 Members | 2,549 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to get current logged in Windows username?



I want to automate the process of logging into an intranet. I want to pull
out the username of the Windows user logged into the machine running the
browser and use the username in my app. How can I get the logged in
username?

Do I have to disable the anonymous access in IIS? I rather not because the
site is running under a certain domain user which has access to certain
folder and network shares and the site needs thsi access for reading and
writing files.

--
John Dalberg
Nov 19 '05 #1
6 4591
Hi John,

If you use Windows authentication and deny anonymous
access, you can use HttpContext.Cur rent.User.Ident ity.Name
to get domain log on user name.

HTH

Elton Wang
el********@hotm ail.com

-----Original Message-----
I want to automate the process of logging into an intranet. I want to pullout the username of the Windows user logged into the machine running thebrowser and use the username in my app. How can I get the logged inusername?

Do I have to disable the anonymous access in IIS? I rather not because thesite is running under a certain domain user which has access to certainfolder and network shares and the site needs thsi access for reading andwriting files.

--
John Dalberg
.

Nov 19 '05 #2
On Wed, 6 Apr 2005 16:14:41 -0700, Eltoon Wang wrote:
Hi John,

If you use Windows authentication and deny anonymous
access, you can use HttpContext.Cur rent.User.Ident ity.Name
to get domain log on user name.

I will explain what I need to do and someone may tell me the proper set up
for this.

I have an ASP.NET intranet that maintains its own user database where users
log in through a form. I would like to streamline the login process so that
users do not have to log in manually to the Intranet. If they are logged in
to the domain and click on the Intranet's url, they are logged in the
Intranet automatically. The Intranet app knows who they are and
authenticate them behind the scene. My idea is that the Window's username
is synced with the Intranet username. Somehow I want my asp.net to pull out
the username from Windows and if it exists in the Intranet database, log in
the user. The Intranet website runs under a domain user which has rights to
certain documents folders for reading and writing purposes. That user is
the anonymous user under which the site runs. If I disable anonymous
security, then the Intranet website will run under which user? The logged
in user? The site needs to run under a single user no matter who's logged
in so that the web app has rights to certain folders locally.
Do I enable impersonation? What's the proper set up for this? LDAP?

TIA

John Dalberg

-----Original Message-----
I want to automate the process of logging into an

intranet. I want to pull
out the username of the Windows user logged into the

machine running the
browser and use the username in my app. How can I get the

logged in
username?

Do I have to disable the anonymous access in IIS? I

rather not because the
site is running under a certain domain user which has

access to certain
folder and network shares and the site needs thsi access

for reading and
writing files.

--
John Dalberg
.

Nov 19 '05 #3
On Wed, 6 Apr 2005 16:14:41 -0700, Eltoon Wang wrote:
Hi John,

If you use Windows authentication and deny anonymous
access, you can use HttpContext.Cur rent.User.Ident ity.Name
to get domain log on user name.


How can you do something similar with Form authentication?

John Dalberg
-----Original Message-----
I want to automate the process of logging into an

intranet. I want to pull
out the username of the Windows user logged into the

machine running the
browser and use the username in my app. How can I get the

logged in
username?

Do I have to disable the anonymous access in IIS? I

rather not because the
site is running under a certain domain user which has

access to certain
folder and network shares and the site needs thsi access

for reading and
writing files.

--
John Dalberg
.

--

John Dalberg
Nov 19 '05 #4
Try going through this articles:-

http://support.microsoft.com/default...b;EN-US;308157

http://www.c-sharpcorner.com/Code/20...cationWithAD.a
sp

Hope it helps
Patrick

*** Sent via Developersdex http://www.developersdex.com ***
Nov 19 '05 #5
On Sun, 17 Apr 2005 21:46:07 -0700, Patrick Olurotimi Ige wrote:
Try going through this articles:-

http://support.microsoft.com/default...b;EN-US;308157

http://www.c-sharpcorner.com/Code/20...cationWithAD.a
sp

Thanks. These articles explain how forms authentication work which I
already know. The point I was making is how to know who is the current user
who authenticated on the Intranet form and if their session is still
active. I wanted to get this info from my app which appears inside the
Intranet. I can't read the Intranet app's cookie because I have no access
to it because my app is a separate app and not part of it.

It seems using Windows authentication is a better way. It also means that
users do not need to authenticate to the Intranet if they are already
authenticated in Windows.

--
John Dalberg
Nov 19 '05 #6
On Wed, 6 Apr 2005 16:14:41 -0700, Eltoon Wang wrote:
Hi John,

If you use Windows authentication and deny anonymous
access, you can use HttpContext.Cur rent.User.Ident ity.Name
to get domain log on user name.

Now I am in a delimma. For HttpContext.Cur rent.User.Ident ity.Name to work,
"anonymous access" needs to be turned off but I need the Intranet app run
under a domain user who has access to network shares. Otherwise if I have
intergrated Windows security used then I have to maintain all kinds of ntfs
permissions and probably all kinds of others issues which I can't think of
right now. Access to folders is maintained by the Intranet app.

John Dalberg


-----Original Message-----
I want to automate the process of logging into an

intranet. I want to pull
out the username of the Windows user logged into the

machine running the
browser and use the username in my app. How can I get the

logged in
username?

Do I have to disable the anonymous access in IIS? I

rather not because the
site is running under a certain domain user which has

access to certain
folder and network shares and the site needs thsi access

for reading and
writing files.

--
John Dalberg
.

--
John Dalberg
Nov 19 '05 #7

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

Similar topics

1
8115
by: Rudolf Bargholz | last post by:
Hi, DB2 v7.1 FP3 on Windows 2003 I am trying to acheive the following: create trigger ADD_LHL after insert on MAINTABLE for each row mode db2sql insert into LOGTABLE
4
2406
by: Kristof Despiere | last post by:
Suppose you have one domain, filled with a couple of users. What needs to be done now is I need to start a windows application from a webform by pressing a button on the webform (for example). The problem is that the user who "owns" the service is always the ASPNET account. That's not good since you don't see the actual application (because...
1
10127
by: Sudhakara.T.P. | last post by:
Hi, I have an application in VB.NET windows application, wherein the administrator has the option to change the authentication mode ie., whether the application should work as a normal database authentication or the windows based authentication mode. If the administrator sets the application authentication mode to windows based, then the...
13
39201
by: Steve Enzer | last post by:
How can I get the login name of the user currently logged into Windows as a string? Thanks, Steve Enzer
5
36993
by: mvr | last post by:
Hi all How to get the Windows current logged user name using Classic ASP. If no direct way are there any work arounds. Thanks mvr
0
3787
by: D-Someone | last post by:
We have an active directory user that just had her username renamed. When the user is running an application that calls our CurrentUser web service method (which returns the value of HttpContext.Current.User.Identity.Name), her old username is returned. DOMAIN\oldusername instead of DOMAIN\newusername. The user is logged in with this new...
3
15905
by: Lattis | last post by:
I have the following problem: User A is logged in to a windows 2000 terminal. He runs an application which runs under the credentials of a different user. If I try to see the current user throught the application I can only see the user that started the thread. How can I see the user that is logged in?? I tried the following code: ...
6
5660
by: MuZZy | last post by:
Hi, I am looking to find a way to get currently logged in user's object GUID without querying ActiveDirectory. For example, when i log in to my laptop from home, I'm not on the office network so i can't reach AD but I'm sure i still can get my AD's objectGUID, as the profile is cached locally. Any ideas?
1
7455
by: ranju | last post by:
I am trying to spawn a process (say an exe file) with different user crendentials than that of the current user. 1) Called LogonUserEx() to logon the user and recieve a handle to the token that represents the logged-on user. 2) Called ImpersonateLoggedOnUSer() to let the calling thread impersonate the security context of logged on user. ...
0
8195
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7947
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...
0
8209
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...
0
6596
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5707
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...
0
5386
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...
0
3831
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...
1
1444
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1171
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...

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.