I make a small web application for working with nail polishes.
And I need to somehow visually determine whether I am currently working on the production version of the site or on the developer, I usually look at the appearance of the logo in the header: on the production it looks like this
And the dev version looks like this:
And now it is done through the analysis of the address bar, in the Views / Shared / _Layout.cshtml file:
@functions{ private bool IsDevEnv() { return Context.Request.Host.Value.Contains("localhost"); } } <!DOCTYPE html> <html> .... @if (IsDevEnv()) { <a asp-area="" asp-controller="Home" asp-action="Index" class="navbar-brand">Polish <span>Hub</span></a> } else { <a asp-area="" asp-controller="Home" asp-action="Index" class="navbar-brand">Polish Hub</a> } However, this is not exactly what I need: I need to check the parameters of the sql server connection string, not the hostname of the server. (Unfortunately, these are the features of the appharbor for working with the core for the current day - in the classic asp.net mvc, variable changes normally occur)
How can I get to these settings (connection string) in the asp.net core?
Is it possible to somehow get to the Configuration.GetConnectionString in view? Or, if it is not possible, then from which level to define the mode variable (prod / dev) in order to forward it to the page layout.


dev версия, I read it as PornHub, I'm afraid I’m not the only one who will have such associations, something needs to be done with this :) - Bulson