Zdenek
Zdenek

Reputation: 55

LogOn user in Browser

Hallo.

I need know user name of user which run browser.

If I use

Request.ServerVariables["LOGON_USER"]

or

HttpContext.Current.User.Identity.Name 

or

User.Identity.Name

it is OK, if I run browser under same account like I'm loged in windows.

But if I run windows as #user1 and browser as #user2, value of this LOGON_USER is empty string.

Is there another way how detect user?

Upvotes: 0

Views: 333

Answers (2)

Jay
Jay

Reputation: 6294

The correct way to get your user is:

HttpContext.Current.User.Identity.Name

This will work as long as the user is authenticated.

Upvotes: 2

Related Questions