Vladyslav Furdak
Vladyslav Furdak

Reputation: 1835

asp.net SERVER_NAME returns wrong domain name

Can anyone explain me how the asp.net/iis gets SERVER_NAME variable ? The problem appears when we change our production domain name. The backend code returns old value by calling the following method Request.ServerVariables["SERVER_NAME"] . Could it be related to DNS update ?

Upvotes: 3

Views: 865

Answers (1)

Eric J.
Eric J.

Reputation: 150108

The backend code returns old value by calling the following method Request.ServerVariables["SERVER_NAME"]

Generally this variable returns

The server's host name, DNS alias, or IP address as it would appear in self-referencing URLs.

Check

  • That the DNS changes have propogated to this server. Do a reverse DNS lookup on the server itself. If this is the case, flush the local DNS cache (ipconfig /flushdns)
  • Make sure the DNS PTR record has been correctly updated
  • That the host name isn't set to match the old DNS name

Upvotes: 3

Related Questions