Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Environment.UserName layoutrenderer #3381

Closed
snakefoot opened this issue May 8, 2019 · 1 comment
Closed

Implement Environment.UserName layoutrenderer #3381

snakefoot opened this issue May 8, 2019 · 1 comment

Comments

@snakefoot
Copy link
Contributor

Right now one can use these:

Both are extremely slow, and the second one doesn't support impersonations. But there are actually much faster calls:

  • Environment.UserName
  • Environment.UserDomainName

And these should support impersonation, and should also be available of NetCore:

  • On Windows the UserName property wraps a call to the Windows GetUserName function. The domain account credentials for a user are formatted as the user's domain name, the '' character, and user name. Use the UserDomainName property to obtain the user's domain name and the UserName property to obtain the user name.

  • On Unix platforms the UserName property wraps a call to the getpwuid_r function.

  • If an ASP.NET application runs in a development environment, the UserName property returns the name of the current user. In a published ASP.NET application, this property returns the name of the application pool account (such as Default AppPool).

See the output here:

https://richhewlett.com/2011/02/15/getting-a-users-username-in-asp-net/

@304NotModified
Copy link
Member

304NotModified commented May 15, 2019

PS Dunno why issues aren't closed when linked pull requests are merged

@snakefoot snakefoot added this to the 4.6.4 milestone Jan 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants