Question
How do the .NET agents handle application naming?
Answer
Default
IIS Hosted .NET Framework Applications
By default, the agent will name the application based on its virtual path in IIS.
For example, if the application is hosted at https://<hostname>/MyApp
, then the application will be named MyApp.
If the application is hosted at the root of a Site (i.e. the virtual path is /
) then the name of the Site will be used as the application name.
.NET Core Applications
In the case of .NET Core, whether running in IIS or standalone, the agent uses the AppDomain's friendly name property.
Azure App Services and Functions
For applications running as an Azure App Service, the WEBSITE_SITE_NAME
(which is set by Azure to be the App Service name, or "Title") will be used as the application name. It will append a virtual path to this, if one is configured.
Override
The application name displayed in Contrast can be overridden from the default by setting the configuration option contrast.application.name
(details of the various options and locations where they can be set are documented here and here - for example the option could be set in a contrast_security.yaml
file in the application's root folder, or via an environment variable or in the application's web.config
file).
The order of precedence of configuration options for all agents is described here.
contrast.application.name
"globally" by doing so in a contrast_security.yaml
in the agent specific or server level configuration directory, or by setting an environment variable at the system level. When doing so, ALL applications running on the server will be onboarded in Contrast into a single Application of that name. As a result, to avoid confusion, it is recommended that this approach should be avoided.
Allowing the agent to determine the application name by itself is generally the best approach.