Search:
Namespaces
Discussions
.NET v1.1
Feedback
How do I get Windows Environment Variable USERNAME from an Intranet App?
Messages
Related Types
This message was discovered on
ASPFriends.com 'aspngfreeforall' list
.
chris
I've tried using the
Environment
class, but the UserName property returns
ASPNET, the windows user that started the thread. I've tried other
combinations, such as using a
WindowsIdentity
to populate a
WindowsPrincipal
object, but with the same end result. I would like to get the
%USERNAME% environment variable to transparently identify the current user
of an intranet app. I'd like to do this without authenticating the user, as
they would already have logged in to our intranet to use their computer.
TIA,
-Chris Frazier
.NET Solution Developer
Velocity Databank, Inc.
www.velocitydatabank.com
Reply to this message...
Barry J. Akester
Try this...
lblLabel.Text =3D User.Identity.Name;
Barry
-----Original Message-----
From: chris [mailto:
Click here to reveal e-mail address
]
Sent: Monday, August 12, 2002 1:22 PM
To: aspngfreeforall
Subject: [aspngfreeforall] How do I get Windows
Environment
Variable
USERNAME from an Intranet App?
I've tried using the
Environment
class, but the UserName property
returns
ASPNET, the windows user that started the thread. I've tried other
combinations, such as using a
WindowsIdentity
to populate a
WindowsPrincipal
object, but with the same end result. I would like to get the
%USERNAME% environment variable to transparently identify the current
user
of an intranet app. I'd like to do this without authenticating the user,
as
they would already have logged in to our intranet to use their computer.
TIA,
-Chris Frazier
.NET Solution Developer
Velocity Databank, Inc.
www.velocitydatabank.com
| ASP.net DOCS =3D
http://www.aspng.com/docs
| [aspngfreeforall] member
Click here to reveal e-mail address
=3D YOUR ID
|
http://www.asplists.com/aspngfreeforall
=3D JOIN/QUIT
| news://ls.asplists.com =3D NEWSGROUP
Reply to this message...
chris
Thanks. I researched it a little and found that it doesn't look like it will
work in the context I need it. I ran a trace on the page that I tested this
in, and the stateless nature of http is the killer of this idea. setting
lblLabel.Text =
Environment
.UserName; output ASPNET, which is the user that
kicked off the threat as far as the computer is concerned. I also tried
building a winform and accessing the same environment variable that way; in
the constructor of Form1:
string user =
Environment
.UserName;
lblLabel.Text = "Hey there, " + user + "!!";
The result was "Hey there, chris!". So it looks like if I want to use the
scheme I originally planned for, I'll have to use winforms. No thanks, I'll
stick with ASP.NET.
-Chris Frazier
.NET Solution Developer
Velocity Databank, Inc.
www.velocitydatabank.com
-----Original Message-----
From: Barry J. Akester [mailto:
Click here to reveal e-mail address
]
Sent: Monday, August 12, 2002 12:48 PM
To: aspngfreeforall
Subject: [aspngfreeforall] RE: How do I get Windows
Environment
Variable
USERNAME from an Intranet App?
Try this...
lblLabel.Text = User.Identity.Name;
Barry
-----Original Message-----
From: chris [mailto:
Click here to reveal e-mail address
]
Sent: Monday, August 12, 2002 1:22 PM
To: aspngfreeforall
Subject: [aspngfreeforall] How do I get Windows
Environment
Variable
USERNAME from an Intranet App?
I've tried using the
Environment
class, but the UserName property
returns
ASPNET, the windows user that started the thread. I've tried other
combinations, such as using a
WindowsIdentity
to populate a
WindowsPrincipal
object, but with the same end result. I would like to get the
%USERNAME% environment variable to transparently identify the current
user
of an intranet app. I'd like to do this without authenticating the user,
as
they would already have logged in to our intranet to use their computer.
TIA,
-Chris Frazier
.NET Solution Developer
Velocity Databank, Inc.
www.velocitydatabank.com
| ASP.net DOCS =
http://www.aspng.com/docs
| [aspngfreeforall] member
Click here to reveal e-mail address
= YOUR ID
|
http://www.asplists.com/aspngfreeforall
= JOIN/QUIT
| news://ls.asplists.com = NEWSGROUP
| ASP.net DOCS =
http://www.aspng.com/docs
| [aspngfreeforall] member
Click here to reveal e-mail address
= YOUR ID
|
http://www.asplists.com/aspngfreeforall
= JOIN/QUIT
| news://ls.asplists.com = NEWSGROUP
Reply to this message...
Srinivasa Sivakumar
Chris,
I think you are trying to get the Windows OS login from ASP.NET.
What you can do it, enable the Windows authentication from the Web.config
file and look at the "AUTH_USER" server variable. May be this will help you.
----- Original Message -----
From: "chris" <
Click here to reveal e-mail address
>
To: "aspngfreeforall" <
Click here to reveal e-mail address
>
Sent: Monday, August 12, 2002 2:03 PM
Subject: [aspngfreeforall] RE: How do I get Windows
Environment
Variable
USERNAME from an Intranet App?
> Thanks. I researched it a little and found that it doesn't look like it
will
> work in the context I need it. I ran a trace on the page that I tested
this
[Original message clipped]
Reply to this message...
Barry J. Akester
Have you tried turing on impersonation?
<authentication mode=3D"Windows" />=20
<identity impersonate=3D"true" />
Barry
-----Original Message-----
From: chris [mailto:
Click here to reveal e-mail address
]
Sent: Monday, August 12, 2002 3:03 PM
To: aspngfreeforall
Subject: [aspngfreeforall] RE: How do I get Windows
Environment
Variable
USERNAME from an Intranet App?
Thanks. I researched it a little and found that it doesn't look like it
will
work in the context I need it. I ran a trace on the page that I tested
this
in, and the stateless nature of http is the killer of this idea. setting
lblLabel.Text =3D
Environment
.UserName; output ASPNET, which is the user
that
kicked off the threat as far as the computer is concerned. I also tried
building a winform and accessing the same environment variable that way;
in
the constructor of Form1:
string user =3D
Environment
.UserName;
lblLabel.Text =3D "Hey there, " + user + "!!";
The result was "Hey there, chris!". So it looks like if I want to use
the
scheme I originally planned for, I'll have to use winforms. No thanks,
I'll
stick with ASP.NET.
-Chris Frazier
.NET Solution Developer
Velocity Databank, Inc.
www.velocitydatabank.com
-----Original Message-----
From: Barry J. Akester [mailto:
Click here to reveal e-mail address
]
Sent: Monday, August 12, 2002 12:48 PM
To: aspngfreeforall
Subject: [aspngfreeforall] RE: How do I get Windows
Environment
Variable
USERNAME from an Intranet App?
Try this...
lblLabel.Text =3D User.Identity.Name;
Barry
-----Original Message-----
From: chris [mailto:
Click here to reveal e-mail address
]
Sent: Monday, August 12, 2002 1:22 PM
To: aspngfreeforall
Subject: [aspngfreeforall] How do I get Windows
Environment
Variable
USERNAME from an Intranet App?
I've tried using the
Environment
class, but the UserName property
returns
ASPNET, the windows user that started the thread. I've tried other
combinations, such as using a
WindowsIdentity
to populate a
WindowsPrincipal
object, but with the same end result. I would like to get the
%USERNAME% environment variable to transparently identify the current
user
of an intranet app. I'd like to do this without authenticating the user,
as
they would already have logged in to our intranet to use their computer.
TIA,
-Chris Frazier
.NET Solution Developer
Velocity Databank, Inc.
www.velocitydatabank.com
| ASP.net DOCS =3D
http://www.aspng.com/docs
| [aspngfreeforall] member
Click here to reveal e-mail address
=3D YOUR ID
|
http://www.asplists.com/aspngfreeforall
=3D JOIN/QUIT
| news://ls.asplists.com =3D NEWSGROUP
| ASP.net DOCS =3D
http://www.aspng.com/docs
| [aspngfreeforall] member
Click here to reveal e-mail address
=3D YOUR ID
|
http://www.asplists.com/aspngfreeforall
=3D JOIN/QUIT
| news://ls.asplists.com =3D NEWSGROUP
| ASP.net DOCS =3D
http://www.aspng.com/docs
| [aspngfreeforall] member
Click here to reveal e-mail address
=3D YOUR ID
|
http://www.asplists.com/aspngfreeforall
=3D JOIN/QUIT
| news://ls.asplists.com =3D NEWSGROUP
Reply to this message...
System.Environment
System.Security.Principal.WindowsIdentity
System.Security.Principal.WindowsPrincipal
Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us
-
Terms of Use
-
Privacy Policy
-
www.dotnet247.com