473,385 Members | 1,400 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,385 software developers and data experts.

Getting Windows Username

I am developing an intranet and was wondering, when a user logs on is there
a way to get the username of the windows account in asp.net.

I have tried the following but they return the worker process username e.g
DOMAIN\ASPNET

Can somone suggest a way or provide some code the get the username of the
logged on account in windows

Thanks
Jonathan Dixon

User.Identity.Name.ToString();

System.Security.Principal.WindowsIdentity.GetCurre nt().Name.ToString();

Nov 18 '05 #1
8 2946
Sorry it was just a matter of disabling anononous access, will this have any
implications

"Jonathan Dixon" <jo**@ukonline.co.uk> wrote in message
news:ew*************@TK2MSFTNGP12.phx.gbl...
I am developing an intranet and was wondering, when a user logs on is there a way to get the username of the windows account in asp.net.

I have tried the following but they return the worker process username e.g
DOMAIN\ASPNET

Can somone suggest a way or provide some code the get the username of the
logged on account in windows

Thanks
Jonathan Dixon

User.Identity.Name.ToString();

System.Security.Principal.WindowsIdentity.GetCurre nt().Name.ToString();


Nov 18 '05 #2

"Jonathan Dixon" <jo**@ukonline.co.uk> wrote in message
news:OB**************@TK2MSFTNGP12.phx.gbl...
Sorry it was just a matter of disabling anononous access, will this have any implications


sure it will. if you are running with anonymous access, the app runs in the
security context of the worker process. If you are using windows
authenticated access, the app will run in the security context of the logged
on user. For instance, file permissions etc will depend on the user
accessing the application.

also, obviously people without a windows account will not be able to access
the application

whether this is a problem for your specific application depends on what the
app does.

"Jonathan Dixon" <jo**@ukonline.co.uk> wrote in message
news:ew*************@TK2MSFTNGP12.phx.gbl...
I am developing an intranet and was wondering, when a user logs on is

there
a way to get the username of the windows account in asp.net.

I have tried the following but they return the worker process username e.g DOMAIN\ASPNET

Can somone suggest a way or provide some code the get the username of the logged on account in windows

Thanks
Jonathan Dixon

User.Identity.Name.ToString();

System.Security.Principal.WindowsIdentity.GetCurre nt().Name.ToString();



Nov 18 '05 #3
I have came accross a problem when putting it on a server it ust get the
servers logon name,

Is there a way, it will be a intranet and users will logon with the user
account onto windows, the intranet web page will then appear, i want the
intranet web page to get the account name from the person logged on to the
computer in the asp.net page.
I hope that is clear i am not sure how to phrase it so
if i logon as

Jonathan

the asp.net webpage would get Jonathan
at the same time a colleague logs on to windows as andrew, the intranet web
page loads up and get his username which is andrew.

Any idea how to do this.

Regards

Jonathan Dixon
Nov 18 '05 #4
to do this, you need to use windows integrated authentication

"Jonathan Dixon" <jo**@ukonline.co.uk> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
I have came accross a problem when putting it on a server it ust get the
servers logon name,

Is there a way, it will be a intranet and users will logon with the user
account onto windows, the intranet web page will then appear, i want the
intranet web page to get the account name from the person logged on to the
computer in the asp.net page.
I hope that is clear i am not sure how to phrase it so
if i logon as

Jonathan

the asp.net webpage would get Jonathan
at the same time a colleague logs on to windows as andrew, the intranet web page loads up and get his username which is andrew.

Any idea how to do this.

Regards

Jonathan Dixon

Nov 18 '05 #5
How exactly would i do that
Thanks

"Andy Fish" <aj****@blueyonder.co.uk> wrote in message
news:_c*********************@news-text.cableinet.net...
to do this, you need to use windows integrated authentication

"Jonathan Dixon" <jo**@ukonline.co.uk> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
I have came accross a problem when putting it on a server it ust get the
servers logon name,

Is there a way, it will be a intranet and users will logon with the user
account onto windows, the intranet web page will then appear, i want the
intranet web page to get the account name from the person logged on to the computer in the asp.net page.
I hope that is clear i am not sure how to phrase it so
if i logon as

Jonathan

the asp.net webpage would get Jonathan
at the same time a colleague logs on to windows as andrew, the intranet

web
page loads up and get his username which is andrew.

Any idea how to do this.

Regards

Jonathan Dixon


Nov 18 '05 #6
in internet services manager, go to web site properties, directory security,
anonymous access, and ensure that only 'integrated windows authentication'
is checked

"Jonathan Dixon" <jo**@ukonline.co.uk> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
How exactly would i do that
Thanks

"Andy Fish" <aj****@blueyonder.co.uk> wrote in message
news:_c*********************@news-text.cableinet.net...
to do this, you need to use windows integrated authentication

"Jonathan Dixon" <jo**@ukonline.co.uk> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
I have came accross a problem when putting it on a server it ust get the servers logon name,

Is there a way, it will be a intranet and users will logon with the user account onto windows, the intranet web page will then appear, i want the intranet web page to get the account name from the person logged on to the computer in the asp.net page.
I hope that is clear i am not sure how to phrase it so
if i logon as

Jonathan

the asp.net webpage would get Jonathan
at the same time a colleague logs on to windows as andrew, the
intranet web
page loads up and get his username which is andrew.

Any idea how to do this.

Regards

Jonathan Dixon



Nov 18 '05 #7
I have done that but it returns the name of the user logged on at the server
not the client running the intranet on the system they are logged on at.

Thanks for your continuing help

Regards

Jonathan Dixon
"Andy Fish" <aj****@blueyonder.co.uk> wrote in message
news:Is*********************@news-text.cableinet.net...
in internet services manager, go to web site properties, directory security, anonymous access, and ensure that only 'integrated windows authentication'
is checked

"Jonathan Dixon" <jo**@ukonline.co.uk> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
How exactly would i do that
Thanks

"Andy Fish" <aj****@blueyonder.co.uk> wrote in message
news:_c*********************@news-text.cableinet.net...
to do this, you need to use windows integrated authentication

"Jonathan Dixon" <jo**@ukonline.co.uk> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
> I have came accross a problem when putting it on a server it ust get the > servers logon name,
>
> Is there a way, it will be a intranet and users will logon with the user > account onto windows, the intranet web page will then appear, i want the > intranet web page to get the account name from the person logged on
to
the
> computer in the asp.net page.
>
>
> I hope that is clear i am not sure how to phrase it so
>
>
> if i logon as
>
> Jonathan
>
> the asp.net webpage would get Jonathan
>
>
> at the same time a colleague logs on to windows as andrew, the

intranet web
> page loads up and get his username which is andrew.
>
> Any idea how to do this.
>
> Regards
>
> Jonathan Dixon
>
>



Nov 18 '05 #8
Jonathan Dixon wrote:
I have done that but it returns the name of the user logged on at the server
not the client running the intranet on the system they are logged on at.

Thanks for your continuing help

Regards

Jonathan Dixon
"Andy Fish" <aj****@blueyonder.co.uk> wrote in message
news:Is*********************@news-text.cableinet.net...
in internet services manager, go to web site properties, directory


security,
anonymous access, and ensure that only 'integrated windows authentication'
is checked

"Jonathan Dixon" <jo**@ukonline.co.uk> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl.. .
How exactly would i do that
Thanks

"Andy Fish" <aj****@blueyonder.co.uk> wrote in message
news:_c*********************@news-text.cableinet.net...

to do this, you need to use windows integrated authentication

"Jonathan Dixon" <jo**@ukonline.co.uk> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl.. .

>I have came accross a problem when putting it on a server it ust get


the
>servers logon name,
>
>Is there a way, it will be a intranet and users will logon with the


user
>account onto windows, the intranet web page will then appear, i want


the
>intranet web page to get the account name from the person logged on
to
the

>computer in the asp.net page.
>
>
>I hope that is clear i am not sure how to phrase it so
>
>
>if i logon as
>
>Jonathan
>
>the asp.net webpage would get Jonathan
>
>
>at the same time a colleague logs on to windows as andrew, the


intranet
web

>page loads up and get his username which is andrew.
>
>Any idea how to do this.
>
>Regards
>
>Jonathan Dixon
>
>



Hello,

Add the following to the AUTHENTICATION of web.config

<authentication mode="Windows" />

Chiefdnd
Nov 18 '05 #9

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

Similar topics

2
by: Mark | last post by:
In this article http://support.microsoft.com/?id=329290 I will have to perform this in my installation. The question is since the aspnet_setreg.exe does not automatically grant the asp.net service...
11
by: Derek Martin | last post by:
Using VB.Net, I would like to retrieve the currently logged in user's DN from Active Directory. Alternatively, if, using WindowsIdentity, or something similar, I would like to get the user's full...
13
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
by: Jon | last post by:
I am trying to figure out how to get the client's AD username. So far everything I've found with google boils down to the following: System.Environment.UserName...
1
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...
8
by: Bruno Barros | last post by:
Hey there. I'm currently working on an intranet, and would like to know how I can get the windows usernames of the visitors. You can get their IP with $_SERVER; But what about their Windows...
10
by: priyakollu | last post by:
hi guyz! please help me in sorting out error as im unable to find it... my requirement is there will be userid field and password field and "login" button after clicking button certain validations...
6
NawazAhmed
by: NawazAhmed | last post by:
Hi, I was trying to get local system's username in my code behind. I tried every almost possible way. Here is the scenario: My project is web based and I don't have a login screen....I need to get...
8
by: tiijnar | last post by:
Hi, To get windows username Im using the following code. public class GetWindowUsername { public String getUser() { String userName = System.getProperty("user.name");...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.