Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Getting Windows Username

Reply
Thread Tools

Getting Windows Username

 
 
Jonathan Dixon
Guest
Posts: n/a
 
      07-21-2004
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();





 
Reply With Quote
 
 
 
 
Jonathan Dixon
Guest
Posts: n/a
 
      07-21-2004
Sorry it was just a matter of disabling anononous access, will this have any
implications



"Jonathan Dixon" <> wrote in message
news:...
> 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();
>
>
>
>
>



 
Reply With Quote
 
 
 
 
Andy Fish
Guest
Posts: n/a
 
      07-21-2004

"Jonathan Dixon" <> wrote in message
news:...
> 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" <> wrote in message
> news:...
> > 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();
> >
> >
> >
> >
> >

>
>



 
Reply With Quote
 
Jonathan Dixon
Guest
Posts: n/a
 
      07-21-2004
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


 
Reply With Quote
 
Andy Fish
Guest
Posts: n/a
 
      07-21-2004
to do this, you need to use windows integrated authentication

"Jonathan Dixon" <> wrote in message
news:%...
> 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
>
>



 
Reply With Quote
 
Jonathan Dixon
Guest
Posts: n/a
 
      07-21-2004
How exactly would i do that


Thanks

"Andy Fish" <> wrote in message
news:_cvLc.4770$...
> to do this, you need to use windows integrated authentication
>
> "Jonathan Dixon" <> wrote in message
> news:%...
> > 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
> >
> >

>
>



 
Reply With Quote
 
Andy Fish
Guest
Posts: n/a
 
      07-21-2004
in internet services manager, go to web site properties, directory security,
anonymous access, and ensure that only 'integrated windows authentication'
is checked

"Jonathan Dixon" <> wrote in message
news:%...
> How exactly would i do that
>
>
> Thanks
>
> "Andy Fish" <> wrote in message
> news:_cvLc.4770$...
> > to do this, you need to use windows integrated authentication
> >
> > "Jonathan Dixon" <> wrote in message
> > news:%...
> > > 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
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
Jonathan Dixon
Guest
Posts: n/a
 
      07-22-2004
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" <> wrote in message
news:IswLc.4829$...
> in internet services manager, go to web site properties, directory

security,
> anonymous access, and ensure that only 'integrated windows authentication'
> is checked
>
> "Jonathan Dixon" <> wrote in message
> news:%...
> > How exactly would i do that
> >
> >
> > Thanks
> >
> > "Andy Fish" <> wrote in message
> > news:_cvLc.4770$...
> > > to do this, you need to use windows integrated authentication
> > >
> > > "Jonathan Dixon" <> wrote in message
> > > news:%...
> > > > 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
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
user@domain.invalid
Guest
Posts: n/a
 
      07-23-2004
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" <> wrote in message
> news:IswLc.4829$...
>
>>in internet services manager, go to web site properties, directory

>
> security,
>
>>anonymous access, and ensure that only 'integrated windows authentication'
>>is checked
>>
>>"Jonathan Dixon" <> wrote in message
>>news:%.. .
>>
>>>How exactly would i do that
>>>
>>>
>>>Thanks
>>>
>>>"Andy Fish" <> wrote in message
>>>news:_cvLc.4770$...
>>>
>>>>to do this, you need to use windows integrated authentication
>>>>
>>>>"Jonathan Dixon" <> wrote in message
>>>>news:%.. .
>>>>
>>>>>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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
loginview control displays network username instead of (web) username Shailesh Patel ASP .Net Web Controls 0 11-08-2006 08:19 PM
Getting windows username Jonathan Dixon ASP .Net Security 3 07-23-2004 10:43 AM
Change the username found in "C:\Documents and Settings\Username" The Reluctant Robot Named Jude Computer Support 1 05-05-2004 07:11 AM
getting username logged in Brian Henry ASP .Net 2 08-27-2003 07:22 PM
Q329290 getting ASP.NET userName Mark ASP .Net 2 08-06-2003 04:01 PM



Advertisments