How to get server domain name

.net, asp.net, c#, dns

Solution

It looks to me like you are trying to find the user's domain name. Since you are asking for the Environment.UserDomainName. Since your site is likely running with "Allow Anonymous Access" - the user isn't passing their domain information to the server and IIS is giving you the account information it does have, namely the app pool account.

Problem

Can anybody tell me how to get servers domain name in asp.net? (`Environment.UserDomainName` returns "IIS APPPOOL" string) Thanks for replays, but mostly they are about DNS name of the server, what I need is the domain name. For example when I login via windows authentication I type domain\user and I need this "domain"

Original source

Related problems